summaryrefslogtreecommitdiff
path: root/runtime/js/40_process.js
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-05-11 13:53:45 +0100
committerGitHub <noreply@github.com>2023-05-11 14:53:45 +0200
commit2ba9ccc1ab25e5c631afcbb12b53f4545ca7f750 (patch)
tree38edbbacb6682b178e0356bf38fbb1f91cc5fe93 /runtime/js/40_process.js
parent20c42286f88d861192f35d272a645d8ab6f15be8 (diff)
fix(runtime): `ChildProcess::kill()` doesn't require additional perms (#15339)
Fixes #15217.
Diffstat (limited to 'runtime/js/40_process.js')
-rw-r--r--runtime/js/40_process.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/js/40_process.js b/runtime/js/40_process.js
index 2a5ac86bf..664a4b303 100644
--- a/runtime/js/40_process.js
+++ b/runtime/js/40_process.js
@@ -200,6 +200,7 @@ function collectOutput(readableStream) {
class ChildProcess {
#rid;
#waitPromiseId;
+ #waitComplete = false;
#unrefed = false;
#pid;
@@ -268,8 +269,8 @@ class ChildProcess {
const waitPromise = core.opAsync("op_spawn_wait", this.#rid);
this.#waitPromiseId = waitPromise[promiseIdSymbol];
this.#status = PromisePrototypeThen(waitPromise, (res) => {
- this.#rid = null;
signal?.[abortSignal.remove](onAbort);
+ this.#waitComplete = true;
return res;
});
}
@@ -317,10 +318,10 @@ class ChildProcess {
}
kill(signo = "SIGTERM") {
- if (this.#rid === null) {
+ if (this.#waitComplete) {
throw new TypeError("Child process has already terminated.");
}
- ops.op_kill(this.#pid, signo, "Deno.Child.kill()");
+ ops.op_spawn_kill(this.#rid, signo);
}
ref() {