node: ensure that streams2 won't `.end()` stdin
authorFedor Indutny <fedor@indutny.com>
Sat, 21 Mar 2015 23:19:04 +0000 (16:19 -0700)
committerFedor Indutny <fedor@indutny.com>
Sun, 22 Mar 2015 02:51:08 +0000 (19:51 -0700)
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
PR-URL: https://github.com/iojs/io.js/pull/1233
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
src/node.js

index 7215f74..dbadc66 100644 (file)
               writable: false
             });
           }
+          // Make sure the stdin can't be `.end()`-ed
+          stdin._writableState.ended = true;
           break;
 
         default: