'SIGINT' or 'SIGHUP'. If omitted, the signal will be 'SIGTERM'.
See kill(2) for more information.
+Will throw an error if target does not exist, and as a special case, a signal of
+`0` can be used to test for the existence of a process.
+
Note that just because the name of this function is `process.kill`, it is
really just a signal sender, like the `kill` system call. The signal sent
may do something other than kill the target process.
process.kill(process.pid, 'SIGHUP');
-Note: SIGUSR1 is reserved by node.js. It can be used to kickstart the
-debugger.
+Note: When SIGUSR1 is received by Node.js it starts the debugger, see
+[Signal Events](#process_signal_events).
## process.pid
r = process._kill(pid, 0);
} else {
sig = sig || 'SIGTERM';
- if (startup.lazyConstants()[sig]) {
+ if (startup.lazyConstants()[sig] &&
+ sig.slice(0, 3) === 'SIG') {
r = process._kill(pid, startup.lazyConstants()[sig]);
} else {
throw new Error('Unknown signal: ' + sig);
var cat = spawn('cat');
var called;
-process.kill(cat.pid, 0);
+assert.ok(process.kill(cat.pid, 0));
+
+cat.on('exit', function() {
+ assert.throws(function() {
+ process.kill(cat.pid, 0);
+ }, Error);
+});
cat.stdout.on('data', function() {
called = true;