mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
* Make common.skip() exit. Also add common.printSkipMessage() for partial skips. * Don't make needless things before skip Backport-PR-URL: https://github.com/nodejs/node/pull/14838 PR-URL: https://github.com/nodejs/node/pull/14021 Fixes: https://github.com/nodejs/node/issues/14016 Reviewed-By: Refael Ackermann <refack@gmail.com>
34 lines
804 B
JavaScript
34 lines
804 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
if (common.isWindows)
|
|
common.skip('SIGUSR1 and SIGHUP signals are not supported');
|
|
|
|
console.log(`process.pid: ${process.pid}`);
|
|
|
|
process.on('SIGUSR1', common.mustCall());
|
|
|
|
process.on('SIGUSR1', common.mustCall(function() {
|
|
setTimeout(function() {
|
|
console.log('End.');
|
|
process.exit(0);
|
|
}, 5);
|
|
}));
|
|
|
|
let i = 0;
|
|
setInterval(function() {
|
|
console.log(`running process...${++i}`);
|
|
|
|
if (i === 5) {
|
|
process.kill(process.pid, 'SIGUSR1');
|
|
}
|
|
}, 1);
|
|
|
|
// Test on condition where a watcher for SIGNAL
|
|
// has been previously registered, and `process.listeners(SIGNAL).length === 1`
|
|
process.on('SIGHUP', common.mustNotCall());
|
|
process.removeAllListeners('SIGHUP');
|
|
process.on('SIGHUP', common.mustCall());
|
|
process.kill(process.pid, 'SIGHUP');
|