mirror of
https://github.com/denoland/deno.git
synced 2024-12-15 11:58:42 -05:00
17 lines
378 B
JavaScript
17 lines
378 B
JavaScript
|
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);
|
||
|
});
|
||
|
}
|