Deno.spawn

Executes a subprocess, waiting for it to finish and collecting all of its output. Will throw an error if stdin: "piped" is passed.

const { status, stdout, stderr } = await Deno.spawn(Deno.execPath(), {
  args: [
    "eval",
       "console.log('hello'); console.error('world')",
  ],
});
console.assert(status.code === 0);
console.assert("hello\n" === new TextDecoder().decode(stdout));
console.assert("world\n" === new TextDecoder().decode(stderr));
function spawn<T extends SpawnOptions = SpawnOptions>(command: string | URL, options?: T): Promise<SpawnOutput<T>>;
§
spawn<T extends SpawnOptions = SpawnOptions>(command: string | URL, options?: T): Promise<SpawnOutput<T>>
[src]

§Type Parameters

§Parameters

§
command: string | URL
[src]
§
options?: T optional
[src]

§Return Type

§
Promise<SpawnOutput<T>>
[src]