- Version: many
- Platform: Windows 7 x64
- Subsystem: process
The doc states:
Note: Windows does not support sending signals, but Node.js offers some emulation with process.kill(), and ChildProcess.kill().
WRT supporting signals on Windows, the doc makes only this remark:
SIGTERM is not supported on Windows, it can be listened on.
As for the rest, process.kill() behavior on Windows is somehow confusing and hazardous. A test file with just this line:
process.kill(process.pid, SIGNAL_NAME_MENTIONED_IN_THE_DOC);
gives three types of results.
SIGTERM, SIGINT, SIGKILL (despite the doc note wrt SIGTERM) — silently exit.
SIGUSR1, SIGPIPE, SIGSTOP, SIGBUS — throw this error:
internal/process.js:184
throw new Error(`Unknown signal: ${sig}`);
^
Error: Unknown signal: SIGUSR1
at process.kill (internal/process.js:184:15)
at Object.<anonymous> (...\test.js:5:9)
at Module._compile (module.js:607:30)
at Object.Module._extensions..js (module.js:618:10)
at Module.load (module.js:516:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.runMain (module.js:643:10)
at run (bootstrap_node.js:441:7)
at startup (bootstrap_node.js:144:9)
SIGHUP, SIGBREAK, SIGWINCH, SIGFPE, SIGSEGV, SIGILL — throw this error:
internal/process.js:190
throw errnoException(err, 'kill');
^
Error: kill ENOSYS
at exports._errnoException (util.js:1057:11)
at process.kill (internal/process.js:190:13)
at Object.<anonymous> (...\test.js:6:9)
at Module._compile (module.js:607:30)
at Object.Module._extensions..js (module.js:618:10)
at Module.load (module.js:516:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.runMain (module.js:643:10)
at run (bootstrap_node.js:441:7)
As with this issue, I am not sure, if this is a Node.js or libuv domain. Also I am not sure if this should be addressed in code or in docs. So just reporting for extra precaution.
The doc states:
WRT supporting signals on Windows, the doc makes only this remark:
As for the rest,
process.kill()behavior on Windows is somehow confusing and hazardous. A test file with just this line:gives three types of results.
SIGTERM,SIGINT,SIGKILL(despite the doc note wrtSIGTERM) — silently exit.SIGUSR1,SIGPIPE,SIGSTOP,SIGBUS— throw this error:SIGHUP,SIGBREAK,SIGWINCH,SIGFPE,SIGSEGV,SIGILL— throw this error:As with this issue, I am not sure, if this is a Node.js or libuv domain. Also I am not sure if this should be addressed in code or in docs. So just reporting for extra precaution.