process.stdin example from docs no longer works in node 10 · Issue #20503 · nodejs/node (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
- Version: 10.0.0 (using nvm)
- Platform: 4.13.0-39-generic README: fix prerequisite list formatting #44~16.04.1-Ubuntu
- Subsystem:
I am running process.stdin
example from docs:
process.stdin.setEncoding('utf8');
process.stdin.on('readable', () => {
const chunk = process.stdin.read();
if (chunk !== null) {
process.stdout.write(data: ${chunk}
);
}
});
process.stdin.on('end', () => { process.stdout.write('end'); });
I expect the same results as in node v9 and below: command line should wait for my input and return it prefixed with data:
. Instead, process is closed right away. I believe this is regression as example works fine in node v9 and v8.
(edited by @addaleax: syntax highlighting)