-
-
Save vladkotu/4351913 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Unpause stream for stdin | |
| process.stdin.resume(); | |
| process.stdin.setEncoding('utf8'); | |
| // Set raw mode (read by char) | |
| // http://unix.stackexchange.com/questions/21752/whats-the-difference-between-a-raw-and-a-cooked-device-driver | |
| process.stdin.setRawMode(true); | |
| // Subscribe to data retrieving event | |
| process.stdin.on('data', function (chunk) { | |
| // Check if end of data stream reached (http://en.wikipedia.org/wiki/List_of_Unicode_characters) | |
| if (chunk === '\u0003'){ | |
| console.log("Bye bye, User!"); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment