From 94975ad2a68ad543ab720ab90bcfacae956a5174 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Sat, 21 Mar 2015 16:19:04 -0700 Subject: [PATCH 1/2] node: ensure that streams2 won't `.end()` stdin Stdin is purely read-only stream. Although, `net.Socket` might be used to create it if stdin is in fact a Pipe or TCP socket, the `stream.Duplex` should not try to call `.end()` on it. Fix: https://github.com/iojs/io.js/issues/1068 --- src/node.js | 2 ++ test/parallel/test-regress-GH-io-1068.js | 1 + 2 files changed, 3 insertions(+) diff --git a/src/node.js b/src/node.js index 7215f747190a3c..b80bc308af1f99 100644 --- a/src/node.js +++ b/src/node.js @@ -630,6 +630,8 @@ writable: false }); } + // Ensure that Streams2 won't try to `.end()` the stream + stdin._writableState.ended = true; break; default: diff --git a/test/parallel/test-regress-GH-io-1068.js b/test/parallel/test-regress-GH-io-1068.js index e769e6b81a880d..aa0cfbd5151765 100644 --- a/test/parallel/test-regress-GH-io-1068.js +++ b/test/parallel/test-regress-GH-io-1068.js @@ -1 +1,2 @@ +debugger; process.stdin.emit('end'); From a365fc48faab7814fe249bdccb11b907825dbdc7 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Sat, 21 Mar 2015 17:30:23 -0700 Subject: [PATCH 2/2] ... --- test/parallel/test-regress-GH-io-1068.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/parallel/test-regress-GH-io-1068.js b/test/parallel/test-regress-GH-io-1068.js index aa0cfbd5151765..e769e6b81a880d 100644 --- a/test/parallel/test-regress-GH-io-1068.js +++ b/test/parallel/test-regress-GH-io-1068.js @@ -1,2 +1 @@ -debugger; process.stdin.emit('end');