diff --git a/lib/process/stdio.js b/lib/process/stdio.js index 172dbae..475c9de 100644 --- a/lib/process/stdio.js +++ b/lib/process/stdio.js @@ -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(); + } }); }