substack/node-pw — pull request #6 by joewreschnig (2014-05-22 09:34:14+00:00)
Title: When encountering etx in an input stream, stop and raise a SIGINT rather than exit successfully.

Because it puts the TTY in raw mode, node-pw inhibits normal ^C behavior in its prompts. Instead it exits with code 0 (success), which is definitely not the right thing. This patch changes it to raise SIGINT, and return without passing the password on if SIGINT was handled elsewhere.

This bug is preventing me from using Vault in a shell script; I want the script to stop when I ^C at the passphrase prompt, but since the exit code is 0 it just keeps going.

Another possibility would be to exit with the appropriate code for SIGINT, which is 128 + SIGINT; I couldn't find a way to get signal values in node.