diff --git a/runtime/js/40_process.js b/runtime/js/40_process.js index 1ee76f5204..ad6c57ad35 100644 --- a/runtime/js/40_process.js +++ b/runtime/js/40_process.js @@ -299,17 +299,16 @@ class ChildProcess { try { const onAbort = () => this.kill("SIGTERM"); signal?.[abortSignal.add](onAbort); + const waitPromise = op_spawn_wait(this.#rid); + this.#waitPromise = waitPromise; + this.#status = PromisePrototypeThen(waitPromise, (res) => { + signal?.[abortSignal.remove](onAbort); + this.#waitComplete = true; + return res; + }); } catch (e) { void e; } - - const waitPromise = op_spawn_wait(this.#rid); - this.#waitPromise = waitPromise; - this.#status = PromisePrototypeThen(waitPromise, (res) => { - signal?.[abortSignal.remove](onAbort); - this.#waitComplete = true; - return res; - }); } #status;