Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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.

If options stdout or stderr are not set to "piped", accessing the corresponding field on SpawnOutput will throw a TypeError.

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

§Parameters

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

§Return Type