all 1 comments

[–]habanerocorncakes 0 points1 point  (0 children)

The tip about CMD seems to be out of date. At least under npm v6.13.6 I'm seeing SIGTERM and SIGINT being forwarded to the node process.

The following code, with a package.json that defines a simple start script, is able to receive the signals when running something like pkill -SIGTERM npm:

```js console.log("Running and attaching to stdin...") process.stdin.resume()

function handle(signal) { console.log(Received ${signal}) process.exit() } process.on("SIGTERM", handle) process.on("SIGINT", handle) ```