Skip to content

Commit fa1bd17

Browse files
authored
Workaround for flappy SIGINT test (#383)
1 parent a320866 commit fa1bd17

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bin/concurrently.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import { map } from 'rxjs/operators';
1212
import stringArgv from 'string-argv';
1313

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

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

0 commit comments

Comments
 (0)