INNER CODE UNIT · TypeScript
killHostTree
Hmbown/CodeWhale · crates/tui/extension-host/src/main.ts:66
function killHostTree(): never {
if (OWN_GROUP) {
try {
process.kill(-process.pid, 'SIGKILL')
} catch {
// Not a group leader after all; exit alone.
}
}
return realExit(0)
}
// A plugin that blocks the event loop would never see stdin EOF, so a
// watchdog on its own thread notices the parent going away (the host is
// re-parented, which PID reuse cannot fake) and kills the tree from there.
const watchdog = new Worker(
`const { workerData } = require('node:worker_threads')
const parent = process.ppid
setInterval(() => {