From 59ac110edd1f376bed7fa6bbdbe2ee09c266bf74 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Sat, 29 Oct 2022 18:25:23 +0900 Subject: fix(core): fix APIs not to be affected by `Promise.prototype.then` modification (#16326) --- runtime/js/40_spawn.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'runtime/js/40_spawn.js') diff --git a/runtime/js/40_spawn.js b/runtime/js/40_spawn.js index a9a968ba3..a927d619e 100644 --- a/runtime/js/40_spawn.js +++ b/runtime/js/40_spawn.js @@ -13,7 +13,8 @@ String, TypeError, Uint8Array, - PromiseAll, + PromisePrototypeThen, + SafePromiseAll, SymbolFor, } = window.__bootstrap.primordials; const { @@ -155,7 +156,7 @@ const waitPromise = core.opAsync("op_spawn_wait", this.#rid); this.#waitPromiseId = waitPromise[promiseIdSymbol]; - this.#status = waitPromise.then((res) => { + this.#status = PromisePrototypeThen(waitPromise, (res) => { this.#rid = null; signal?.[remove](onAbort); return res; @@ -179,7 +180,7 @@ ); } - const [status, stdout, stderr] = await PromiseAll([ + const [status, stdout, stderr] = await SafePromiseAll([ this.#status, collectOutput(this.#stdout), collectOutput(this.#stderr), -- cgit v1.2.3