Skip to content

Commit b5214a2

Browse files
committed
process/stdio: fix ref watching for readable stream.
See: nodejs/node#28153
1 parent 29dc3fd commit b5214a2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/process/stdio.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ class Readable extends stream.Readable {
3030
this._started = false;
3131

3232
this.on('end', () => {
33-
if (this._increments && --this._port._stdioRefs === 0)
34-
this._port._stdioRef.unref();
33+
// See: https://github.com/nodejs/node/pull/28153
34+
if (this._started && this._increments) {
35+
if (--this._port._stdioRefs === 0)
36+
this._port._stdioRef.unref();
37+
}
3538
});
3639
}
3740

0 commit comments

Comments
 (0)