This is my code:
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();
}
And this is what happens:
It seems like there are some line breaks, I tried to replace them, but as you see: without effect.
When I type "quit" it also isn't recognized by if statement.