Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active May 24, 2023 07:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/3e9dc97a2f29c75f4497fe296c0eb07a to your computer and use it in GitHub Desktop.
Save miguelmota/3e9dc97a2f29c75f4497fe296c0eb07a to your computer and use it in GitHub Desktop.
Node.js quit with ctrl-c
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