1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-12 02:27:46 -05:00
denoland-deno/tests/specs/node/child_process_extra_pipes/main.ts
Nathan Whitaker 8749d651fb
fix(node): Create additional pipes for child processes (#25016)
Linux/macos only currently.

Part of https://github.com/denoland/deno/issues/23524 (fixes it on
platforms other than windows).
Part of #16899  (fixes it on platforms other than windows).

After this PR, playwright is functional on mac/linux.
2024-08-15 09:38:46 -07:00

26 lines
566 B
TypeScript

import child_process from "node:child_process";
import { Buffer } from "node:buffer";
import console from "node:console";
const child = child_process.spawn("./test-pipe/target/debug/test-pipe", [], {
stdio: ["inherit", "inherit", "inherit", "ignore", "pipe"],
});
const extra = child.stdio[4];
const p = Promise.withResolvers();
child.on("close", () => {
console.log("child closed");
p.resolve();
});
extra.on("data", (d) => {
console.log("data:", d.toString().trim());
});
extra.on("close", () => {
console.log("pipe closed");
});
await p.promise;