diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2022-04-24 16:21:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-24 17:21:22 +0200 |
commit | e9041b9edc371f2cbd41a354591b5663f2bb4c84 (patch) | |
tree | 243140b739556cfcbf85baa2c0ec1cb058f65975 /runtime/js/40_spawn.js | |
parent | 4b7d306a198d020ce2b6fa1c758c71714bfd036c (diff) |
fix(runtime/js/spawn): Pass stdio options for spawn() and spawnSync() (#14358)
Diffstat (limited to 'runtime/js/40_spawn.js')
-rw-r--r-- | runtime/js/40_spawn.js | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/runtime/js/40_spawn.js b/runtime/js/40_spawn.js index c55ce657d..3b609be8b 100644 --- a/runtime/js/40_spawn.js +++ b/runtime/js/40_spawn.js @@ -166,13 +166,13 @@ } } - function spawn(command, options) { // TODO(@crowlKats): more options (like input)? - return spawnChild(command, { - ...options, - stdin: "null", - stdout: "piped", - stderr: "piped", - }).output(); + function spawn(command, options) { + if (options?.stdin === "piped") { + throw new TypeError( + "Piped stdin is not supported for this function, use 'Deno.spawnChild()' instead", + ); + } + return spawnChild(command, options).output(); } function spawnSync(command, { @@ -182,7 +182,15 @@ env = {}, uid = undefined, gid = undefined, - } = {}) { // TODO(@crowlKats): more options (like input)? + stdin = "null", + stdout = "piped", + stderr = "piped", + } = {}) { + if (stdin === "piped") { + throw new TypeError( + "Piped stdin is not supported for this function, use 'Deno.spawnChild()' instead", + ); + } return core.opSync("op_spawn_sync", { cmd: pathFromURL(command), args: ArrayPrototypeMap(args, String), @@ -191,9 +199,9 @@ env: ObjectEntries(env), uid, gid, - stdin: "null", - stdout: "piped", - stderr: "piped", + stdin, + stdout, + stderr, }); } |