From 212b7dd6da487c070229b6348ec7907b4fecbcf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 27 Sep 2022 22:36:33 +0200 Subject: feat: Add requesting API name to permission prompt (#15936) Co-authored-by: Leo Kettmeir --- runtime/js/40_spawn.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'runtime/js/40_spawn.js') diff --git a/runtime/js/40_spawn.js b/runtime/js/40_spawn.js index 4fae9e6b7..daa4f8ff8 100644 --- a/runtime/js/40_spawn.js +++ b/runtime/js/40_spawn.js @@ -21,7 +21,7 @@ const promiseIdSymbol = SymbolFor("Deno.core.internalPromiseId"); - function spawnChild(command, { + function spawnChildInner(command, apiName, { args = [], cwd = undefined, clearEnv = false, @@ -44,13 +44,17 @@ stdin, stdout, stderr, - }); + }, apiName); return new Child(illegalConstructorKey, { ...child, signal, }); } + function spawnChild(command, options = {}) { + return spawnChildInner(command, "Deno.spawnChild()", options); + } + async function collectOutput(readableStream) { if (!(readableStream instanceof ReadableStream)) { return null; @@ -204,7 +208,7 @@ if (this.#rid === null) { throw new TypeError("Child process has already terminated."); } - ops.op_kill(this.#pid, signo); + ops.op_kill(this.#pid, signo, "Deno.Child.kill()"); } ref() { @@ -228,7 +232,7 @@ "Piped stdin is not supported for this function, use 'Deno.spawnChild()' instead", ); } - return spawnChild(command, options).output(); + return spawnChildInner(command, "Deno.spawn()", options).output(); } function spawnSync(command, { -- cgit v1.2.3