Last active
May 24, 2023 07:14
-
-
Save miguelmota/3e9dc97a2f29c75f4497fe296c0eb07a to your computer and use it in GitHub Desktop.
Node.js quit with ctrl-c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.stdin.setRawMode(true) | |
process.stdin.on('data', function(b) { | |
if (b[0] === 3) { | |
process.stdin.setRawMode(false) | |
process.exit() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment