Please have a read of that document
that explains how to correctly handle process.stdin
. Your mistake was to use stdin.resume
that enables the "old" compatibility mode on process stdin streams.
// nodo.js
function nodo() {
var stdin = process.stdin;
var stdout = process.stdout;
if (stdin.isTTY) {
stdin.setRawMode(true);
stdin.setEncoding('utf8');
stdout.write('\u000A>Bienvenido\u000A');
process.stdin.setEncoding('utf8');
process.stdin.on('readable', function() {
var chunk = process.stdin.read();
if (chunk !== null) {
process.stdout.write('data: ' + chunk);
}
});
process.stdin.on('end', function() {
process.stdout.write('end');
});
} else {
process.exit();
}
}
nodo();