1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-15 11:58:42 -05:00
denoland-deno/tests/specs/node/stdio_ipc/main.mjs

17 lines
378 B
JavaScript
Raw Normal View History

import { spawn } from "node:child_process";
import process from "node:process";
if (process.argv[2] === "child") {
process.send("hahah");
} else {
const proc = spawn(process.execPath, ["./main.mjs", "child"], {
stdio: ["ipc", "inherit", "inherit"],
});
proc.on("message", function (msg) {
console.log(`msg: ${msg}`);
proc.kill();
Deno.exit(0);
});
}