mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 13:05:07 +00:00

The --abort-on-uncaught-exception can terminate the process with either a SIGABRT or a SIGILL signal but the test only expected SIGABRT. PR-URL: https://github.com/nodejs/node/pull/6734 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
35 lines
811 B
JavaScript
35 lines
811 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const spawn = require('child_process').spawn;
|
|
const node = process.execPath;
|
|
|
|
if (process.argv[2] === 'child') {
|
|
throw new Error('child error');
|
|
} else {
|
|
run('', null);
|
|
run('--abort-on-uncaught-exception', ['SIGABRT', 'SIGILL']);
|
|
}
|
|
|
|
function run(flags, signals) {
|
|
const args = [__filename, 'child'];
|
|
if (flags)
|
|
args.unshift(flags);
|
|
|
|
const child = spawn(node, args);
|
|
child.on('exit', common.mustCall(function(code, sig) {
|
|
if (common.isWindows) {
|
|
if (signals)
|
|
assert.strictEqual(code, 3);
|
|
else
|
|
assert.strictEqual(code, 1);
|
|
} else {
|
|
if (signals)
|
|
assert.strictEqual(signals.includes(sig), true);
|
|
else
|
|
assert.strictEqual(sig, null);
|
|
}
|
|
}));
|
|
}
|