Commit 40b817f
Changed files (4)
build/cli.js
build/core.cjs
@@ -387,6 +387,7 @@ var import_vendor_core3 = require("./vendor-core.cjs");
var import_util2 = require("./util.cjs");
var CWD = Symbol("processCwd");
var SYNC = Symbol("syncExec");
+var EPF = Symbol("end-piped-from");
var EOL = import_node_buffer.Buffer.from(import_node_os.EOL);
var BR_CC = "\n".charCodeAt(0);
var DLMTR = /\r?\n/;
@@ -627,7 +628,7 @@ var _ProcessPromise = class _ProcessPromise extends Promise {
fillEnd();
return dest;
}
- from.once("end", () => dest.emit("end-piped-from")).pipe(dest);
+ from.once("end", () => dest.emit(EPF)).pipe(dest);
fillEnd();
return promisifyStream(dest, this);
}
@@ -1035,15 +1036,10 @@ function kill(_0) {
}
var promisifyStream = (stream, from) => (0, import_util.proxyOverride)(stream, {
then(res = import_util.noop, rej = import_util.noop) {
- return new Promise(
- (_res, _rej) => stream.once("error", (e) => _rej(rej(e))).once(
- "finish",
- () => _res(res((0, import_util.proxyOverride)(stream, from._output)))
- ).once(
- "end-piped-from",
- () => _res(res((0, import_util.proxyOverride)(stream, from._output)))
- )
- );
+ return new Promise((_res, _rej) => {
+ const onend = () => _res(res((0, import_util.proxyOverride)(stream, from.output)));
+ stream.once("error", (e) => _rej(rej(e))).once("finish", onend).once(EPF, onend);
+ });
},
run() {
return from.run();
src/core.ts
@@ -74,6 +74,7 @@ export { type Duration, quote, quotePowerShell } from './util.ts'
const CWD = Symbol('processCwd')
const SYNC = Symbol('syncExec')
+const EPF = Symbol('end-piped-from')
const EOL = Buffer.from(_EOL)
const BR_CC = '\n'.charCodeAt(0)
const DLMTR = /\r?\n/
@@ -427,7 +428,7 @@ export class ProcessPromise extends Promise<ProcessOutput> {
return dest
}
- from.once('end', () => dest.emit('end-piped-from')).pipe(dest)
+ from.once('end', () => dest.emit(EPF)).pipe(dest)
fillEnd()
return promisifyStream(dest, this) as Writable &
PromiseLike<ProcessOutput & Writable>
@@ -961,16 +962,13 @@ const promisifyStream = <S extends Writable>(
): S & PromiseLike<ProcessOutput & S> =>
proxyOverride(stream as S & PromiseLike<ProcessOutput & S>, {
then(res: any = noop, rej: any = noop) {
- return new Promise((_res, _rej) =>
+ return new Promise((_res, _rej) => {
+ const onend = () => _res(res(proxyOverride(stream, from.output)))
stream
.once('error', (e) => _rej(rej(e)))
- .once('finish', () =>
- _res(res(proxyOverride(stream, (from as any)._output)))
- )
- .once('end-piped-from', () =>
- _res(res(proxyOverride(stream, (from as any)._output)))
- )
- )
+ .once('finish', onend)
+ .once(EPF, onend)
+ })
},
run() {
return from.run()
.size-limit.json
@@ -15,7 +15,7 @@
"README.md",
"LICENSE"
],
- "limit": "121.95 kB",
+ "limit": "121.85 kB",
"brotli": false,
"gzip": false
},
@@ -29,7 +29,7 @@
"build/globals.js",
"build/deno.js"
],
- "limit": "812.70 kB",
+ "limit": "812.65 kB",
"brotli": false,
"gzip": false
},
@@ -62,7 +62,7 @@
"README.md",
"LICENSE"
],
- "limit": "868.80 kB",
+ "limit": "868.70 kB",
"brotli": false,
"gzip": false
}