Skip to content

Commit 354fba1

Browse files
committed
doc: fix process.stdin example
Fixes: #20503 PR-URL: #25344 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent eaaaa0d commit 354fba1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/api/process.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1856,8 +1856,9 @@ a [Readable][] stream.
18561856
process.stdin.setEncoding('utf8');
18571857

18581858
process.stdin.on('readable', () => {
1859-
const chunk = process.stdin.read();
1860-
if (chunk !== null) {
1859+
let chunk;
1860+
// Use a loop to make sure we read all available data.
1861+
while ((chunk = process.stdin.read()) !== null) {
18611862
process.stdout.write(`data: ${chunk}`);
18621863
}
18631864
});

0 commit comments

Comments
 (0)