Skip to content

Commit 642bd4d

Browse files
Sreepurna Jastirefack
Sreepurna Jasti
authored andcommitted
test: add a simple abort check in windows
raise(SIGABRT) or CRT abort causes exit code 3 and null signal in windows. Looks like this simple assertion is not present in windows. Make this assertion. PR-URL: #12914 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 1d5f5aa commit 642bd4d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
5+
// This test makes sure that an aborted node process
6+
// exits with code 3 on Windows.
7+
// Spawn a child, force an abort, and then check the
8+
// exit code in the parent.
9+
10+
const spawn = require('child_process').spawn;
11+
if (!common.isWindows) {
12+
common.skip('test is windows specific');
13+
return;
14+
}
15+
if (process.argv[2] === 'child') {
16+
process.abort();
17+
} else {
18+
const child = spawn(process.execPath, [__filename, 'child']);
19+
child.on('exit', common.mustCall((code, signal) => {
20+
assert.strictEqual(code, 3);
21+
assert.strictEqual(signal, null);
22+
}));
23+
}

0 commit comments

Comments
 (0)