You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
869 B

'use strict';
const common = require('../common');
if (common.isWindows) {
common.skip('SIGUSR1 and SIGHUP signals are not supported');
return;
}
14 years ago
console.log('process.pid: ' + process.pid);
process.on('SIGUSR1', common.mustCall(function() {}));
process.on('SIGUSR1', common.mustCall(function() {
14 years ago
setTimeout(function() {
console.log('End.');
process.exit(0);
}, 5);
}));
14 years ago
var i = 0;
14 years ago
setInterval(function() {
console.log('running process...' + ++i);
if (i === 5) {
14 years ago
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', function() { common.fail('should not run'); });
process.removeAllListeners('SIGHUP');
process.on('SIGHUP', common.mustCall(function() {}));
process.kill(process.pid, 'SIGHUP');