stream: Writables are not pipe()able
authorisaacs <i@izs.me>
Mon, 25 Feb 2013 06:14:30 +0000 (22:14 -0800)
committerisaacs <i@izs.me>
Wed, 27 Feb 2013 02:54:05 +0000 (18:54 -0800)
commit86433979c6f33f78035011b3a4aa29c26b1e9c67
tree2a920017eee4f121ee7185f7d4d5ffae97418b8d
parent586e160a258336663bdf7f063aae9602fe9e1dc9
stream: Writables are not pipe()able

This handles the fact that stream.Writable inherits from the Stream class,
meaning that it has the legacy pipe() method.  Override that with a pipe()
method that emits an error.

Ensure that Duplex streams ARE still pipe()able, however.

Since the 'readable' flag on streams is sometimes temporary, it's probably
better not to put too much weight on that.  But if something is an instanceof
Writable, rather than of Readable or Duplex, then it's safe to say that
reading from it is the wrong thing to do.

Fix #3647
lib/_stream_writable.js
test/simple/test-stream2-writable.js