You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: common.nodeProcessAborted() does not catch aborts in Windows #12823
Looks like common.nodeProcessAborted() (test/common.js) does not cover Windows aborts comprehensively. Results from MAC and Windows on a sample code show the difference:
'use strict';
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
if (process.argv[2] === 'child') {
process.abort();
} else {
const child = spawn(process.argv[0], [process.argv[1], 'child']);
child.on('exit', common.mustCall((code, signal) => {
console.log('child exited with code: ' + code + ' and signal: ' + signal);
assert(common.nodeProcessAborted(code, signal),
'process should have aborted, but did not');
}));
}
MAC:
child exited with code: null and signal: SIGABRT
Windows:
child exited with code: 3 and signal: null
assert.js:81
throw new assert.AssertionError({
^
AssertionError: process should have aborted, but did not
at ChildProcess.child.on.common.mustCall (D:\gireesh\parser\node\test\parallel\foo.js:12:5)
at ChildProcess.<anonymous> (D:\gireesh\parser\node\test\common.js:452:15)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:208:12)
@@ -548,7 +548,7 @@ exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) {
// On Windows, v8's base::OS::Abort triggers an access violation,
// which corresponds to exit code 3221225477 (0xC0000005)
if (exports.isWindows)
- expectedExitCodes = [3221225477];+ expectedExitCodes = [3221225477, 3];
// When using --abort-on-uncaught-exception, V8 will use
// base::OS::Abort to terminate the process.
resolves the issue. If experts agree, I can fully test and bring it through a PR.
We might want to add a comment that an exit code of 3 is the expected exit code for a program that terminates by calling the C runtime library's abort(), compared to a program that terminates by calling V8's base::OS::Abort which can trigger different behaviors depending on the compiler and other things.
Activity
gireeshpunathil commentedon May 4, 2017
ref: #12288
gireeshpunathil commentedon May 4, 2017
This patch
resolves the issue. If experts agree, I can fully test and bring it through a PR.
Trott commentedon May 4, 2017
/cc @misterdjules
misterdjules commentedon May 5, 2017
The change looks good to me.
We might want to add a comment that an exit code of 3 is the expected exit code for a program that terminates by calling the C runtime library's
abort(), compared to a program that terminates by calling V8'sbase::OS::Abortwhich can trigger different behaviors depending on the compiler and other things.We could add a link to the documentation of the abort function on the MSDN too, but maybe that's overkill and that link could change.
Basically anything that doesn't make people wonder where the value
3comes from is good.refack commentedon Jun 4, 2017
Fixed by #12856