summaryrefslogtreecommitdiff
path: root/runtime/js/40_spawn.js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js/40_spawn.js')
-rw-r--r--runtime/js/40_spawn.js30
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,
});
}