stream: Backport of #11876, fixes missing 'unpipe' event
This is a backport of https://github.com/nodejs/node/pull/11876, specifically commit https://github.com/mcollina/node/commit/9dcf18a5c0449700598d26dd8b0d252c1eb6ce5d.
Ideally this commit can should be easily ported to v6 as well after it has been in the wild for a while.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
stream