summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2022-09-30 00:42:33 +0200
committerGitHub <noreply@github.com>2022-09-30 00:42:33 +0200
commit38f544538b337074cbce317e67859a69bb23684c (patch)
tree507e716e0b25d4a1f42c4ff1424059692d5d304f /runtime/js
parent927f4e2e83719aac3dcc4d9ae422cbbf76bd7bcd (diff)
fix(runtime): no FastStream for unrefable streams (#16095)
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/40_spawn.js26
1 files changed, 12 insertions, 14 deletions
diff --git a/runtime/js/40_spawn.js b/runtime/js/40_spawn.js
index daa4f8ff8..99661bf1a 100644
--- a/runtime/js/40_spawn.js
+++ b/runtime/js/40_spawn.js
@@ -16,8 +16,12 @@
PromiseAll,
SymbolFor,
} = window.__bootstrap.primordials;
- const { readableStreamForRid, writableStreamForRid } =
- window.__bootstrap.streamUtils;
+ const {
+ readableStreamForRidUnrefable,
+ readableStreamForRidUnrefableRef,
+ readableStreamForRidUnrefableUnref,
+ } = window.__bootstrap.streams;
+ const { writableStreamForRid } = window.__bootstrap.streamUtils;
const promiseIdSymbol = SymbolFor("Deno.core.internalPromiseId");
@@ -136,18 +140,12 @@
if (stdoutRid !== null) {
this.#stdoutRid = stdoutRid;
- this.#stdout = readableStreamForRid(stdoutRid, (promise) => {
- this.#stdoutPromiseId = promise[promiseIdSymbol];
- if (this.#unrefed) core.unrefOp(this.#stdoutPromiseId);
- });
+ this.#stdout = readableStreamForRidUnrefable(stdoutRid);
}
if (stderrRid !== null) {
this.#stderrRid = stderrRid;
- this.#stderr = readableStreamForRid(stderrRid, (promise) => {
- this.#stderrPromiseId = promise[promiseIdSymbol];
- if (this.#unrefed) core.unrefOp(this.#stderrPromiseId);
- });
+ this.#stderr = readableStreamForRidUnrefable(stderrRid);
}
const onAbort = () => this.kill("SIGTERM");
@@ -214,15 +212,15 @@
ref() {
this.#unrefed = false;
core.refOp(this.#waitPromiseId);
- if (this.#stdoutPromiseId) core.refOp(this.#stdoutPromiseId);
- if (this.#stderrPromiseId) core.refOp(this.#stderrPromiseId);
+ if (this.#stdout) readableStreamForRidUnrefableRef(this.#stdout);
+ if (this.#stderr) readableStreamForRidUnrefableRef(this.#stderr);
}
unref() {
this.#unrefed = true;
core.unrefOp(this.#waitPromiseId);
- if (this.#stdoutPromiseId) core.unrefOp(this.#stdoutPromiseId);
- if (this.#stderrPromiseId) core.unrefOp(this.#stderrPromiseId);
+ if (this.#stdout) readableStreamForRidUnrefableUnref(this.#stdout);
+ if (this.#stderr) readableStreamForRidUnrefableUnref(this.#stderr);
}
}