Skip to content

Commit

Permalink
Workaround for flappy SIGINT test (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
paescuj committed Nov 14, 2022
1 parent a320866 commit fa1bd17
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bin/concurrently.spec.ts
Expand Up @@ -12,13 +12,13 @@ import { map } from 'rxjs/operators';
import stringArgv from 'string-argv';

const isWindows = process.platform === 'win32';
const createKillMessage = (prefix: string, signal: 'SIGTERM' | 'SIGINT') => {
const createKillMessage = (prefix: string, signal: 'SIGTERM' | 'SIGINT' | string) => {
const map: Record<string, string | number> = {
SIGTERM: isWindows ? 1 : '(SIGTERM|143)',
// Could theoretically be anything (e.g. 0) if process has SIGINT handler
SIGINT: isWindows ? '(3221225786|0)' : '(SIGINT|130|0)',
};
return new RegExp(escapeRegExp(prefix) + ' exited with code ' + map[signal]);
return new RegExp(escapeRegExp(prefix) + ' exited with code ' + (map[signal] ?? signal));
};

let tmpDir: string;
Expand Down Expand Up @@ -193,7 +193,10 @@ describe('exiting conditions', () => {
? // '^C' is echoed by read-echo.js (also happens without the wrapper)
'[0] ^Cnode fixtures/read-echo.js'
: '[0] node fixtures/read-echo.js',
'SIGINT'
// TODO: Flappy value due to race condition, sometimes killed by concurrently (exit code 1),
// sometimes terminated on its own (exit code 0).
// Related issue: https://github.com/open-cli-tools/concurrently/issues/283
isWindows ? '(3221225786|0|1)' : 'SIGINT'
)
)
);
Expand Down

0 comments on commit fa1bd17

Please sign in to comment.