mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
9b2cf1c8eb
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>
25 lines
587 B
JavaScript
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(() => {});
|