1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

BREAKING(unstable): Improve Deno.spawn() stdio API (#14919)

- "SpawnOutput" extends "ChildStatus" instead of composing it
- "SpawnOutput::stdout", "SpawnOutput::stderr", "Child::stdin", 
"Child::stdout" and "Child::stderr" are no longer optional, instead 
made them getters that throw at runtime if that stream wasn't set 
to "piped". 
- Remove the complicated "<T extends SpawnOptions = SpawnOptions>" 
which we currently need to give proper type hints for the availability of 
these fields. Their typings for these would get increasingly complex 
if it became dependent on more options (e.g. "SpawnOptions::pty" 
which if set should make the stdio streams unavailable)
This commit is contained in:
Nayeem Rahman 2022-07-18 14:16:12 +01:00 committed by GitHub
parent 0f6b455c96
commit 45c49034a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 176 additions and 149 deletions

View file

@ -1136,7 +1136,11 @@ declare namespace Deno {
/**
* Spawns a child process.
*
* If stdin is set to "piped", the stdin WritableStream needs to be closed manually.
* 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.
*
* ```ts
* const child = Deno.spawnChild(Deno.execPath(), {
@ -1155,25 +1159,21 @@ declare namespace Deno {
* const status = await child.status;
* ```
*/
export function spawnChild<T extends SpawnOptions = SpawnOptions>(
export function spawnChild(
command: string | URL,
options?: T,
): Child<T>;
export class Child<T extends SpawnOptions> {
readonly stdin: T["stdin"] extends "piped" ? WritableStream<Uint8Array>
: null;
readonly stdout: T["stdout"] extends "inherit" | "null" ? null
: ReadableStream<Uint8Array>;
readonly stderr: T["stderr"] extends "inherit" | "null" ? null
: ReadableStream<Uint8Array>;
options?: SpawnOptions,
): Child;
export class Child {
get stdin(): WritableStream<Uint8Array>;
get stdout(): ReadableStream<Uint8Array>;
get stderr(): ReadableStream<Uint8Array>;
readonly pid: number;
/** Get the status of the child. */
readonly status: Promise<ChildStatus>;
/** Waits for the child to exit completely, returning all its output and status. */
output(): Promise<SpawnOutput<T>>;
output(): Promise<SpawnOutput>;
/** Kills the process with given Signal. Defaults to SIGTERM. */
kill(signo?: Signal): void;
}
@ -1183,61 +1183,60 @@ declare namespace Deno {
* 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`.
*
* ```ts
* const { status, stdout, stderr } = await Deno.spawn(Deno.execPath(), {
* const { code, stdout, stderr } = await Deno.spawn(Deno.execPath(), {
* args: [
* "eval",
* "console.log('hello'); console.error('world')",
* ],
* });
* console.assert(status.code === 0);
* console.assert(code === 0);
* console.assert("hello\n" === new TextDecoder().decode(stdout));
* console.assert("world\n" === new TextDecoder().decode(stderr));
* ```
*/
export function spawn<T extends SpawnOptions = SpawnOptions>(
export function spawn(
command: string | URL,
options?: T,
): Promise<SpawnOutput<T>>;
options?: SpawnOptions,
): Promise<SpawnOutput>;
/**
* Synchronously 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`.
*
* ```ts
* const { status, stdout, stderr } = Deno.spawnSync(Deno.execPath(), {
* const { code, stdout, stderr } = Deno.spawnSync(Deno.execPath(), {
* args: [
* "eval",
* "console.log('hello'); console.error('world')",
* ],
* });
* console.assert(status.code === 0);
* console.assert(code === 0);
* console.assert("hello\n" === new TextDecoder().decode(stdout));
* console.assert("world\n" === new TextDecoder().decode(stderr));
* ```
*/
export function spawnSync<T extends SpawnOptions = SpawnOptions>(
export function spawnSync(
command: string | URL,
options?: T,
): SpawnOutput<T>;
options?: SpawnOptions,
): SpawnOutput;
export type ChildStatus =
| {
success: true;
code: 0;
signal: null;
}
| {
success: false;
export interface ChildStatus {
success: boolean;
code: number;
signal: Signal | null;
};
}
export interface SpawnOutput<T extends SpawnOptions> {
status: ChildStatus;
stdout: T["stdout"] extends "inherit" | "null" ? null : Uint8Array;
stderr: T["stderr"] extends "inherit" | "null" ? null : Uint8Array;
export interface SpawnOutput extends ChildStatus {
get stdout(): Uint8Array;
get stderr(): Uint8Array;
}
}

View file

@ -31,7 +31,7 @@ async function handler(req: Request): Promise<Response> {
}
async function testFetch() {
const { status } = await Deno.spawn(Deno.execPath(), {
const { code } = await Deno.spawn(Deno.execPath(), {
args: [
"run",
"--quiet",
@ -44,11 +44,11 @@ async function testFetch() {
},
});
assertEquals(status.code, 0);
assertEquals(code, 0);
}
async function testModuleDownload() {
const { status } = await Deno.spawn(Deno.execPath(), {
const { code } = await Deno.spawn(Deno.execPath(), {
args: [
"cache",
"--reload",
@ -60,11 +60,11 @@ async function testModuleDownload() {
},
});
assertEquals(status.code, 0);
assertEquals(code, 0);
}
async function testFetchNoProxy() {
const { status } = await Deno.spawn(Deno.execPath(), {
const { code } = await Deno.spawn(Deno.execPath(), {
args: [
"run",
"--quiet",
@ -78,11 +78,11 @@ async function testFetchNoProxy() {
},
});
assertEquals(status.code, 0);
assertEquals(code, 0);
}
async function testModuleDownloadNoProxy() {
const { status } = await Deno.spawn(Deno.execPath(), {
const { code } = await Deno.spawn(Deno.execPath(), {
args: [
"cache",
"--reload",
@ -95,11 +95,11 @@ async function testModuleDownloadNoProxy() {
},
});
assertEquals(status.code, 0);
assertEquals(code, 0);
}
async function testFetchProgrammaticProxy() {
const { status } = await Deno.spawn(Deno.execPath(), {
const { code } = await Deno.spawn(Deno.execPath(), {
args: [
"run",
"--quiet",
@ -109,7 +109,7 @@ async function testFetchProgrammaticProxy() {
"045_programmatic_proxy_client.ts",
],
});
assertEquals(status.code, 0);
assertEquals(code, 0);
}
proxyServer();

View file

@ -4,9 +4,9 @@ try {
console.log(e);
}
const { status } = await Deno.spawn("curl", {
const { success } = await Deno.spawn("curl", {
args: ["--help"],
stdout: "null",
stderr: "inherit",
});
console.log(status.success);
console.log(success);

View file

@ -17,7 +17,7 @@ const fetchProc = await Deno.spawn(Deno.execPath(), {
],
});
console.log(`fetch code: ${fetchProc.status.code}`);
console.log(`fetch code: ${fetchProc.code}`);
const fetchCheckProc = await Deno.spawn(Deno.execPath(), {
stdout: "null",
@ -30,7 +30,7 @@ const fetchCheckProc = await Deno.spawn(Deno.execPath(), {
],
});
console.log(`fetch check code: ${fetchCheckProc.status.code}`);
console.log(`fetch check code: ${fetchCheckProc.code}`);
Deno.removeSync("./lock_write_fetch.json");
@ -47,6 +47,6 @@ const runProc = await Deno.spawn(Deno.execPath(), {
],
});
console.log(`run code: ${runProc.status.code}`);
console.log(`run code: ${runProc.code}`);
Deno.removeSync("./lock_write_fetch.json");

View file

@ -12,8 +12,8 @@ async function getUidAndGid(): Promise<{ uid: number; gid: number }> {
args: ["-g"],
});
assertEquals(uidProc.status.code, 0);
assertEquals(gidProc.status.code, 0);
assertEquals(uidProc.code, 0);
assertEquals(gidProc.code, 0);
const uid = parseInt(new TextDecoder("utf-8").decode(uidProc.stdout));
const gid = parseInt(new TextDecoder("utf-8").decode(gidProc.stdout));

View file

@ -1228,12 +1228,12 @@ Deno.test(
async function client() {
const url = `http://${hostname}:${port}/`;
const args = ["-X", "DELETE", url];
const { status } = await Deno.spawn("curl", {
const { success } = await Deno.spawn("curl", {
args,
stdout: "null",
stderr: "null",
});
assert(status.success);
assert(success);
}
await Promise.all([server(), client()]);
@ -1350,11 +1350,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip, deflate, br",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(output.includes("content-encoding: gzip\r\n"));
@ -1453,11 +1453,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip, deflate, br",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout).toLocaleLowerCase();
assert(output.includes("vary: accept-encoding\r\n"));
assert(!output.includes("content-encoding: "));
@ -1507,11 +1507,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip;q=0.8, br;q=1.0, *;q=0.1",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(output.includes("content-encoding: br\r\n"));
@ -1558,11 +1558,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip, deflate, br",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding, Accept\r\n"));
assert(output.includes("content-encoding: gzip\r\n"));
@ -1613,11 +1613,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip, deflate, br",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(
@ -1670,11 +1670,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip, deflate, br",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(
@ -1727,11 +1727,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip, deflate, br",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(!output.includes("content-encoding: "));
@ -1781,11 +1781,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip, deflate, br",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(!output.includes("content-encoding: "));
@ -1841,11 +1841,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip, deflate, br",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(output.includes("content-encoding: gzip\r\n"));
@ -1963,11 +1963,11 @@ Deno.test({
"--header",
"Accept-Encoding: gzip, deflate, br",
];
const { status, stdout } = await Deno.spawn("curl", {
const { success, stdout } = await Deno.spawn("curl", {
args,
stderr: "null",
});
assert(status.success);
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(output.includes("content-encoding: gzip\r\n"));

View file

@ -74,11 +74,11 @@ Deno.test(
console.log(
${JSON.stringify(Object.keys(expectedEnv))}.map(k => Deno.env.get(k))
)`;
const { status, stdout } = await Deno.spawn(Deno.execPath(), {
const { success, stdout } = await Deno.spawn(Deno.execPath(), {
args: ["eval", src],
env: { ...inputEnv, NO_COLOR: "1" },
});
assertEquals(status.success, true);
assertEquals(success, true);
const expectedValues = Object.values(expectedEnv);
const actualValues = JSON.parse(new TextDecoder().decode(stdout));
assertEquals(actualValues, expectedValues);

View file

@ -262,12 +262,12 @@ if (Deno.build.os === "windows") {
Deno.test(
{ permissions: { run: true, write: true, read: true } },
async function removeFileSymlink() {
const { status } = await Deno.spawn("cmd", {
const { success } = await Deno.spawn("cmd", {
args: ["/c", "mklink", "file_link", "bar"],
stdout: "null",
});
assert(status.success);
assert(success);
await Deno.remove("file_link");
await assertRejects(async () => {
await Deno.lstat("file_link");
@ -278,12 +278,12 @@ if (Deno.build.os === "windows") {
Deno.test(
{ permissions: { run: true, write: true, read: true } },
async function removeDirSymlink() {
const { status } = await Deno.spawn("cmd", {
const { success } = await Deno.spawn("cmd", {
args: ["/c", "mklink", "/d", "dir_link", "bar"],
stdout: "null",
});
assert(status.success);
assert(success);
await Deno.remove("dir_link");
await assertRejects(async () => {
await Deno.lstat("dir_link");

View file

@ -185,14 +185,14 @@ Deno.test(
permissions: { run: true, read: true },
},
async function canExitWhileListeningToSignal() {
const { status } = await Deno.spawn(Deno.execPath(), {
const { code } = await Deno.spawn(Deno.execPath(), {
args: [
"eval",
"--unstable",
"Deno.addSignalListener('SIGINT', () => {})",
],
});
assertEquals(status.code, 0);
assertEquals(code, 0);
},
);

View file

@ -64,9 +64,8 @@ Deno.test(
stderr: "null",
});
assert(child.stdin !== null);
assert(child.stdout === null);
assert(child.stderr === null);
assertThrows(() => child.stdout, TypeError, "stdout is not piped");
assertThrows(() => child.stderr, TypeError, "stderr is not piped");
const msg = new TextEncoder().encode("hello");
const writer = child.stdin.getWriter();
@ -92,9 +91,8 @@ Deno.test(
stderr: "null",
});
assert(child.stdin === null);
assert(child.stdout !== null);
assert(child.stderr === null);
assertThrows(() => child.stdin, TypeError, "stdin is not piped");
assertThrows(() => child.stderr, TypeError, "stderr is not piped");
const readable = child.stdout.pipeThrough(new TextDecoderStream());
const reader = readable.getReader();
@ -122,13 +120,11 @@ Deno.test(
"eval",
"await Deno.stderr.write(new TextEncoder().encode('hello'))",
],
stderr: "piped",
stdout: "null",
});
assert(child.stdin === null);
assert(child.stdout === null);
assert(child.stderr !== null);
assertThrows(() => child.stdin, TypeError, "stdin is not piped");
assertThrows(() => child.stdout, TypeError, "stdout is not piped");
const readable = child.stderr.pipeThrough(new TextDecoderStream());
const reader = readable.getReader();
@ -322,62 +318,62 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function spawnSuccess() {
const { status } = await Deno.spawn(Deno.execPath(), {
const output = await Deno.spawn(Deno.execPath(), {
args: ["eval", "console.log('hello world')"],
});
assertEquals(status.success, true);
assertEquals(status.code, 0);
assertEquals(status.signal, null);
assertEquals(output.success, true);
assertEquals(output.code, 0);
assertEquals(output.signal, null);
},
);
Deno.test(
{ permissions: { run: true, read: true } },
function spawnSyncSuccess() {
const { status } = Deno.spawnSync(Deno.execPath(), {
const output = Deno.spawnSync(Deno.execPath(), {
args: ["eval", "console.log('hello world')"],
});
assertEquals(status.success, true);
assertEquals(status.code, 0);
assertEquals(status.signal, null);
assertEquals(output.success, true);
assertEquals(output.code, 0);
assertEquals(output.signal, null);
},
);
Deno.test(
{ permissions: { run: true, read: true } },
async function spawnUrl() {
const { status, stdout } = await Deno.spawn(
const output = await Deno.spawn(
new URL(`file:///${Deno.execPath()}`),
{
args: ["eval", "console.log('hello world')"],
},
);
assertEquals(new TextDecoder().decode(stdout), "hello world\n");
assertEquals(new TextDecoder().decode(output.stdout), "hello world\n");
assertEquals(status.success, true);
assertEquals(status.code, 0);
assertEquals(status.signal, null);
assertEquals(output.success, true);
assertEquals(output.code, 0);
assertEquals(output.signal, null);
},
);
Deno.test(
{ permissions: { run: true, read: true } },
function spawnSyncUrl() {
const { status, stdout } = Deno.spawnSync(
const output = Deno.spawnSync(
new URL(`file:///${Deno.execPath()}`),
{
args: ["eval", "console.log('hello world')"],
},
);
assertEquals(new TextDecoder().decode(stdout), "hello world\n");
assertEquals(new TextDecoder().decode(output.stdout), "hello world\n");
assertEquals(status.success, true);
assertEquals(status.code, 0);
assertEquals(status.signal, null);
assertEquals(output.success, true);
assertEquals(output.code, 0);
assertEquals(output.signal, null);
},
);
@ -398,24 +394,24 @@ Deno.test({ permissions: { run: true } }, function spawnSyncNotFound() {
Deno.test(
{ permissions: { run: true, read: true } },
async function spawnFailedWithCode() {
const { status } = await Deno.spawn(Deno.execPath(), {
const output = await Deno.spawn(Deno.execPath(), {
args: ["eval", "Deno.exit(41 + 1)"],
});
assertEquals(status.success, false);
assertEquals(status.code, 42);
assertEquals(status.signal, null);
assertEquals(output.success, false);
assertEquals(output.code, 42);
assertEquals(output.signal, null);
},
);
Deno.test(
{ permissions: { run: true, read: true } },
function spawnSyncFailedWithCode() {
const { status } = Deno.spawnSync(Deno.execPath(), {
const output = Deno.spawnSync(Deno.execPath(), {
args: ["eval", "Deno.exit(41 + 1)"],
});
assertEquals(status.success, false);
assertEquals(status.code, 42);
assertEquals(status.signal, null);
assertEquals(output.success, false);
assertEquals(output.code, 42);
assertEquals(output.signal, null);
},
);
@ -424,16 +420,16 @@ Deno.test(
permissions: { run: true, read: true },
},
async function spawnFailedWithSignal() {
const { status } = await Deno.spawn(Deno.execPath(), {
const output = await Deno.spawn(Deno.execPath(), {
args: ["eval", "--unstable", "Deno.kill(Deno.pid, 'SIGKILL')"],
});
assertEquals(status.success, false);
assertEquals(output.success, false);
if (Deno.build.os === "windows") {
assertEquals(status.code, 1);
assertEquals(status.signal, null);
assertEquals(output.code, 1);
assertEquals(output.signal, null);
} else {
assertEquals(status.code, 128 + 9);
assertEquals(status.signal, "SIGKILL");
assertEquals(output.code, 128 + 9);
assertEquals(output.signal, "SIGKILL");
}
},
);
@ -443,16 +439,16 @@ Deno.test(
permissions: { run: true, read: true },
},
function spawnSyncFailedWithSignal() {
const { status } = Deno.spawnSync(Deno.execPath(), {
const output = Deno.spawnSync(Deno.execPath(), {
args: ["eval", "--unstable", "Deno.kill(Deno.pid, 'SIGKILL')"],
});
assertEquals(status.success, false);
assertEquals(output.success, false);
if (Deno.build.os === "windows") {
assertEquals(status.code, 1);
assertEquals(status.signal, null);
assertEquals(output.code, 1);
assertEquals(output.signal, null);
} else {
assertEquals(status.code, 128 + 9);
assertEquals(status.signal, "SIGKILL");
assertEquals(output.code, 128 + 9);
assertEquals(output.signal, "SIGKILL");
}
},
);

View file

@ -31,7 +31,7 @@ export function pathToAbsoluteFileUrl(path: string): URL {
const decoder = new TextDecoder();
export async function execCode(code: string): Promise<[number, string]> {
const { status, stdout } = await Deno.spawn(Deno.execPath(), {
const output = await Deno.spawn(Deno.execPath(), {
args: [
"eval",
"--unstable",
@ -39,5 +39,5 @@ export async function execCode(code: string): Promise<[number, string]> {
code,
],
});
return [status.code, decoder.decode(stdout)];
return [output.code, decoder.decode(output.stdout)];
}

View file

@ -1019,12 +1019,12 @@ function createHttpsListener(port: number): Deno.Listener {
}
async function curl(url: string): Promise<string> {
const { status, stdout } = await Deno.spawn("curl", {
const { success, code, stdout } = await Deno.spawn("curl", {
args: ["--insecure", url],
});
if (!status.success) {
throw new Error(`curl ${url} failed: ${status.code}`);
if (!success) {
throw new Error(`curl ${url} failed: ${code}`);
}
return new TextDecoder().decode(stdout);
}

View file

@ -77,21 +77,27 @@
return this.#pid;
}
#stdinRid;
#stdin = null;
get stdin() {
if (this.#stdin == null) {
throw new TypeError("stdin is not piped");
}
return this.#stdin;
}
#stdoutRid;
#stdout = null;
get stdout() {
if (this.#stdout == null) {
throw new TypeError("stdout is not piped");
}
return this.#stdout;
}
#stderrRid;
#stderr = null;
get stderr() {
if (this.#stderr == null) {
throw new TypeError("stderr is not piped");
}
return this.#stderr;
}
@ -111,17 +117,14 @@
this.#pid = pid;
if (stdinRid !== null) {
this.#stdinRid = stdinRid;
this.#stdin = writableStreamForRid(stdinRid);
}
if (stdoutRid !== null) {
this.#stdoutRid = stdoutRid;
this.#stdout = readableStreamForRid(stdoutRid);
}
if (stderrRid !== null) {
this.#stderrRid = stderrRid;
this.#stderr = readableStreamForRid(stderrRid);
}
@ -159,9 +162,21 @@
]);
return {
status,
stdout,
stderr,
success: status.success,
code: status.code,
signal: status.signal,
get stdout() {
if (stdout == null) {
throw new TypeError("stdout is not piped");
}
return stdout;
},
get stderr() {
if (stderr == null) {
throw new TypeError("stderr is not piped");
}
return stderr;
},
};
}
@ -198,7 +213,7 @@
"Piped stdin is not supported for this function, use 'Deno.spawnChild()' instead",
);
}
return core.opSync("op_spawn_sync", {
const result = core.opSync("op_spawn_sync", {
cmd: pathFromURL(command),
args: ArrayPrototypeMap(args, String),
cwd: pathFromURL(cwd),
@ -210,6 +225,23 @@
stdout,
stderr,
});
return {
success: result.status.success,
code: result.status.code,
signal: result.status.signal,
get stdout() {
if (result.stdout == null) {
throw new TypeError("stdout is not piped");
}
return result.stdout;
},
get stderr() {
if (result.stderr == null) {
throw new TypeError("stderr is not piped");
}
return result.stderr;
},
};
}
window.__bootstrap.spawn = {

@ -1 +1 @@
Subproject commit 2e180b039369a06d46adf506142b597c7ea28f35
Subproject commit ec11374217b94e8d0ca604e669faabe5ade5d9a4