2022-04-26 14:46:49 -04:00
|
|
|
Deno.test("output", async () => {
|
2024-01-16 20:18:19 -05:00
|
|
|
await new Deno.Command(Deno.execPath(), {
|
|
|
|
args: ["eval", "console.log(0); console.error(1);"],
|
|
|
|
}).spawn().status;
|
2022-12-02 08:43:17 -05:00
|
|
|
new Deno.Command(Deno.execPath(), {
|
2022-05-01 14:44:55 -04:00
|
|
|
args: ["eval", "console.log(2); console.error(3);"],
|
2022-04-26 14:46:49 -04:00
|
|
|
stdout: "inherit",
|
|
|
|
stderr: "inherit",
|
2022-12-02 08:43:17 -05:00
|
|
|
}).outputSync();
|
|
|
|
await new Deno.Command(Deno.execPath(), {
|
2022-05-01 14:44:55 -04:00
|
|
|
args: ["eval", "console.log(4); console.error(5);"],
|
2022-04-26 14:46:49 -04:00
|
|
|
stdout: "inherit",
|
|
|
|
stderr: "inherit",
|
2022-12-02 08:43:17 -05:00
|
|
|
}).output();
|
|
|
|
const c = new Deno.Command(Deno.execPath(), {
|
2022-05-01 14:44:55 -04:00
|
|
|
args: ["eval", "console.log(6); console.error(7);"],
|
2022-04-26 14:46:49 -04:00
|
|
|
stdout: "inherit",
|
|
|
|
stderr: "inherit",
|
2022-12-02 08:43:17 -05:00
|
|
|
}).spawn();
|
2022-04-26 14:46:49 -04:00
|
|
|
await c.status;
|
2022-04-26 19:00:04 -04:00
|
|
|
const worker = new Worker(
|
2024-09-16 15:38:40 -04:00
|
|
|
import.meta.resolve("./captured_output.worker.ts"),
|
2022-04-26 19:00:04 -04:00
|
|
|
{ type: "module" },
|
|
|
|
);
|
|
|
|
|
|
|
|
// ensure worker output is captured
|
|
|
|
const response = new Promise<void>((resolve) =>
|
|
|
|
worker.onmessage = () => resolve()
|
|
|
|
);
|
|
|
|
worker.postMessage({});
|
|
|
|
await response;
|
|
|
|
worker.terminate();
|
2022-04-26 14:46:49 -04:00
|
|
|
});
|