0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-signal-args.js
Robert Rossmann 9b2cf1c8eb process: Send signal name to signal handlers
PR-URL: https://github.com/nodejs/node/pull/15606
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2017-11-22 14:35:39 -08:00

25 lines
587 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
if (common.isWindows) {
common.skip('Sending signals with process.kill is not supported on Windows');
}
process.once('SIGINT', common.mustCall((signal) => {
assert.strictEqual(signal, 'SIGINT');
}));
process.kill(process.pid, 'SIGINT');
process.once('SIGTERM', common.mustCall((signal) => {
assert.strictEqual(signal, 'SIGTERM');
}));
process.kill(process.pid, 'SIGTERM');
// Prevent Node.js from exiting due to empty event loop before signal handlers
// are fired
setImmediate(() => {});