node/test/abort/test-signal-handler.js
Evan Lucas e155b1f2f7 test: correct test comment
This corrects a comment on the signal type used in the test.

PR-URL: https://github.com/nodejs/node/pull/38095
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-04-06 13:32:56 -05:00

25 lines
869 B
JavaScript

'use strict';
const common = require('../common');
if (common.isWindows)
common.skip('No signals on Window');
const assert = require('assert');
const { spawnSync } = require('child_process');
// Test that a hard crash does not cause an endless loop.
if (process.argv[2] === 'child') {
const { internalBinding } = require('internal/test/binding');
const { causeSegfault } = internalBinding('process_methods');
causeSegfault();
} else {
const child = spawnSync(process.execPath,
['--expose-internals', __filename, 'child'],
{ stdio: 'inherit' });
// FreeBSD uses SIGILL for this kind of crash.
// macOS uses SIGILL or SIGTRAP (arm64) for this kind of crash.
assert(child.signal === 'SIGSEGV' || child.signal === 'SIGILL' ||
child.signal === 'SIGTRAP', `child.signal = ${child.signal}`);
}