diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-06-29 13:33:54 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-07-02 15:42:22 -0700 |
commit | 4dff05f4a7ba93782ab2fdf6124941bb82128f78 (patch) | |
tree | 62dfcb5fcce6b4a5605bcce2e86b11c161cc8140 /test/abort/test-process-abort-exitcode.js | |
parent | 31349e224576f1846a900958c9fecf566d07a04c (diff) | |
download | android-node-v8-4dff05f4a7ba93782ab2fdf6124941bb82128f78.tar.gz android-node-v8-4dff05f4a7ba93782ab2fdf6124941bb82128f78.tar.bz2 android-node-v8-4dff05f4a7ba93782ab2fdf6124941bb82128f78.zip |
src: fix process.abort() interaction with V8
Since V8 5.9 V8 installs a default signal handler for some signals
when creating a default platform instance that prints a stack trace.
However, Node already does the same thing, so it would seem like the
two different stack traces would be printed; also, the V8 handler
would lead to a `SIGSEGV` under some circumstances, rather than
letting the abort continue normally.
Resolve this by disabling V8’s signal handler by default.
PR-URL: https://github.com/nodejs/node/pull/13985
Fixes: https://github.com/nodejs/node/issues/13865
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/abort/test-process-abort-exitcode.js')
-rw-r--r-- | test/abort/test-process-abort-exitcode.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/abort/test-process-abort-exitcode.js b/test/abort/test-process-abort-exitcode.js new file mode 100644 index 0000000000..b29f9dc75c --- /dev/null +++ b/test/abort/test-process-abort-exitcode.js @@ -0,0 +1,24 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +// This test makes sure that an aborted node process +// exits with code 3 on Windows, and SIGABRT on POSIX. +// Spawn a child, force an abort, and then check the +// exit code in the parent. + +const spawn = require('child_process').spawn; +if (process.argv[2] === 'child') { + process.abort(); +} else { + const child = spawn(process.execPath, [__filename, 'child']); + child.on('exit', common.mustCall((code, signal) => { + if (common.isWindows) { + assert.strictEqual(code, 3); + assert.strictEqual(signal, null); + } else { + assert.strictEqual(code, null); + assert.strictEqual(signal, 'SIGABRT'); + } + })); +} |