diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-09-27 22:36:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-27 22:36:33 +0200 |
commit | 212b7dd6da487c070229b6348ec7907b4fecbcf9 (patch) | |
tree | 3eb743f90e8b293182a830722eb4ff26bec72039 /runtime/js | |
parent | a344368603063bcb281e743f3810ca1e4e46e85d (diff) |
feat: Add requesting API name to permission prompt (#15936)
Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
Diffstat (limited to 'runtime/js')
-rw-r--r-- | runtime/js/40_process.js | 12 | ||||
-rw-r--r-- | runtime/js/40_spawn.js | 12 |
2 files changed, 16 insertions, 8 deletions
diff --git a/runtime/js/40_process.js b/runtime/js/40_process.js index e3f6fc7a0..76ce57fe3 100644 --- a/runtime/js/40_process.js +++ b/runtime/js/40_process.js @@ -16,8 +16,12 @@ String, } = window.__bootstrap.primordials; - function opKill(pid, signo) { - ops.op_kill(pid, signo); + function opKill(pid, signo, apiName) { + ops.op_kill(pid, signo, apiName); + } + + function kill(pid, signo) { + opKill(pid, signo, "Deno.kill()"); } function opRunStatus(rid) { @@ -91,7 +95,7 @@ } kill(signo) { - opKill(this.pid, signo); + opKill(this.pid, signo, "Deno.Process.kill()"); } } @@ -126,6 +130,6 @@ window.__bootstrap.process = { run, Process, - kill: opKill, + kill, }; })(this); 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, { |