const started = Date.now(); let got: unknown = null; const proc = Bun.spawn(["bun", `${import.meta.dir}/child.ts`], { stdio: ["ignore", "inherit", "inherit"], serialization: "advanced", ipc: (m) => { got = m; }, }); const timeout = new Promise((r) => setTimeout(() => r("TIMEOUT"), 4000)); const outcome = await Promise.race([proc.exited, timeout]); console.info(JSON.stringify({ outcome, got, ms: Date.now() - started })); if (outcome === "TIMEOUT") proc.kill();