Deprecated
Use the Deno.Command API instead.
Spawns a child process.
If any stdio options are not set to "piped"
, accessing the corresponding
field on the Child
or its SpawnOutput
will throw a TypeError
.
If stdin
is set to "piped"
, the stdin
WritableStream
needs to be closed manually.
const child = Deno.spawnChild(Deno.execPath(), {
args: [
"eval",
"console.log('Hello World')",
],
stdin: "piped",
});
// open a file and pipe the subprocess output to it.
child.stdout.pipeTo(Deno.openSync("output").writable);
// manually close stdin
child.stdin.close();
const status = await child.status;
import { Deno } from "https://deno.land/x/deno@v1.28.3/cli/tsc/dts/lib.deno.unstable.d.ts";
const { spawnChild } = Deno;
UNSTABLE: New API, yet to be vetted.
Parameters
command: string | URL
optional
options: SpawnOptions