mafintosh / duplexify

Turn a writable and readable stream into a streams2 duplex stream with support for async initialization and streams1/streams2 input
MIT License
190 stars 36 forks source link

Fix 'Cannot call write after a stream was destroyed' #29

Closed vweevers closed 5 years ago

vweevers commented 5 years ago

Related to #27, I found a new edge case.

This PR adds two tests and a fix. Without the fix, the first test would fail with 'Cannot call write after a stream was destroyed'. The second test is to ensure the other code path still works, that is:

https://github.com/mafintosh/duplexify/blob/9dc80c1387d92270f2878c467e84a897973a71f7/index.js#L208

Followed by:

https://github.com/mafintosh/duplexify/blob/9dc80c1387d92270f2878c467e84a897973a71f7/index.js#L190

vweevers commented 5 years ago

cc @mcollina

mcollina commented 5 years ago

Makes total sense.

mafintosh commented 5 years ago

4.1.0