stream: prevent 'end' to be emitted after 'error'
This PR adds _readableState.errorEmitted and add the tracking of it.
Fixes: https://github.com/nodejs/node/issues/6083 See: https://github.com/nodejs/node/issues/20334 See: https://github.com/nodejs/node/pull/20449
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines