1 2 3 4 5 6 7 8 9 10 11 12 13
const { spawn } = require("node:child_process"); function exitHandler() { console.log("exithHandler called"); } function closeHandler() { console.log("closeHandler called"); } const p = spawn("bun", ["--version"]); p.on("exit", exitHandler); p.on("close", closeHandler);