Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
doc: fix process.stdin example
Fixes: #20503
  • Loading branch information
addaleax committed Jan 4, 2019
commit 20e27e18b16626ca2921a478680f6c34864a5518
5 changes: 3 additions & 2 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1856,8 +1856,9 @@ a [Readable][] stream.
process.stdin.setEncoding('utf8');

process.stdin.on('readable', () => {
const chunk = process.stdin.read();
if (chunk !== null) {
let chunk;
// Use a loop to make sure we read all available data.
while ((chunk = process.stdin.read()) !== null) {
process.stdout.write(`data: ${chunk}`);
}
});
Expand Down