Skip to content

Commit

Permalink
node: ensure that streams2 won't .end() stdin
Browse files Browse the repository at this point in the history
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: nodejs#1068
  • Loading branch information
indutny committed Mar 21, 2015
1 parent 99c79f8 commit 94975ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@
writable: false
});
}
// Ensure that Streams2 won't try to `.end()` the stream
stdin._writableState.ended = true;
break;

default:
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-regress-GH-io-1068.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
debugger;
process.stdin.emit('end');

0 comments on commit 94975ad

Please sign in to comment.