Deno.spawnSync
Synchronously 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 } = Deno.spawnSync(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 spawnSync<T extends SpawnOptions = SpawnOptions>(command: string | URL, options?: T): SpawnOutput<T>;
§
spawnSync<T extends SpawnOptions = SpawnOptions>(command: string | URL, options?: T): SpawnOutput<T>
[src]§Type Parameters
§
T extends SpawnOptions = SpawnOptions
[src]