Skip to content

Instantly share code, notes, and snippets.

@piotrek-k
Created March 28, 2014 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piotrek-k/9830119 to your computer and use it in GitHub Desktop.
Save piotrek-k/9830119 to your computer and use it in GitHub Desktop.
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (text) {
text.replace(/\r?\n|\r/g, "");
console.log("Command: " + text + "textthatshouldbeinthesameline");
if (text == 'quit') {
console.log("Quitting");
done();
}
});
function done() {
console.log('Now that process.stdin is paused, there is nothing more to do.');
process.exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment