Skip to content

Commit

Permalink
process/stdio: fix ref watching for readable stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Jun 11, 2019
1 parent 29dc3fd commit b5214a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/process/stdio.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ class Readable extends stream.Readable {
this._started = false;

this.on('end', () => {
if (this._increments && --this._port._stdioRefs === 0)
this._port._stdioRef.unref();
// See: https://github.com/nodejs/node/pull/28153
if (this._started && this._increments) {
if (--this._port._stdioRefs === 0)
this._port._stdioRef.unref();
}
});
}

Expand Down

0 comments on commit b5214a2

Please sign in to comment.