mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
Stop closing STDOUT/STDERR in lib/streams.ts (#5419)
Fixes #5403 for Node versions prior to v10.12.0.
This commit is contained in:
parent
a8b9bed753
commit
15fe4d2ff1
|
|
@ -366,11 +366,14 @@ export class WriteStream {
|
|||
this.drainListeners.push(resolve);
|
||||
});
|
||||
};
|
||||
options.end = function () {
|
||||
return new Promise(resolve => {
|
||||
this.nodeWritableStream!.end(() => resolve());
|
||||
});
|
||||
};
|
||||
// Prior to Node v10.12.0, attempting to close STDOUT or STDERR will throw
|
||||
if (nodeStream !== process.stdout && nodeStream !== process.stderr) {
|
||||
options.end = function () {
|
||||
return new Promise(resolve => {
|
||||
this.nodeWritableStream!.end(() => resolve());
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (options.write) this._write = options.write;
|
||||
|
|
@ -671,11 +674,14 @@ export class ObjectWriteStream<T> {
|
|||
}
|
||||
};
|
||||
|
||||
options.end = function () {
|
||||
return new Promise(resolve => {
|
||||
this.nodeWritableStream!.end(() => resolve());
|
||||
});
|
||||
};
|
||||
// Prior to Node v10.12.0, attempting to close STDOUT or STDERR will throw
|
||||
if (nodeStream !== process.stdout && nodeStream !== process.stderr) {
|
||||
options.end = function () {
|
||||
return new Promise(resolve => {
|
||||
this.nodeWritableStream!.end(() => resolve());
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (options.write) this._write = options.write;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user