Skip to content

Commit

Permalink
chore: try again
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonoh committed Nov 8, 2020
1 parent 6530b6f commit f63df7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 10 additions & 3 deletions src/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '../test/mock-ec2-endpoints';
import { consoleMockCallJoin } from '../test/utils';
import { main } from './cli';
import { Console } from 'console';

setBlocking(true);

Expand Down Expand Up @@ -170,11 +171,17 @@ describe('cli', () => {

await new Promise(res => {
const s = spawn('node', [cliJsPath, '--help']);
s.stdout.on('data', (data: Buffer) => output.push(data.toString()));
s.on('exit', res);
s.stdout.on('data', (data: Buffer) => {
output.push(data.toString());
console.log('>>> data', data.toString());
});
s.on('close', () => {
console.log('>>> close', output);
res();
});
});

console.log(output);
console.log(output.join(''));

expect(output.join('')).toMatchSnapshot();
});
Expand Down
3 changes: 1 addition & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,10 @@ export const main = (argvInput?: string[]): Promise<void> =>
/* istanbul ignore next */
const cleanExit = (): void => {
process.stdout.write('\n');
process.exit(255);
process.exit();
};
process.on('SIGINT', cleanExit); // catch ctrl-c
process.on('SIGTERM', cleanExit); // catch kill
process.on('exit', cleanExit); // catch exit

/* istanbul ignore if */
if (
Expand Down

0 comments on commit f63df7e

Please sign in to comment.