Unified · Split
| @@ -808,6 +808,9 @@ · 807 unmodified lines | ||
| 808 | 808 | "tsup": "catalog:", |
| 809 | 809 | "vitest": "catalog:", |
| 810 | 810 | }, |
| 811 | + "peerDependencies": { | |
| 812 | + "effect": "catalog:", | |
| 813 | + }, | |
| 811 | 814 | }, |
| 812 | 815 | "packages/plugins/desktop-settings": { |
| 813 | 816 | "name": "@executor-js/plugin-desktop-settings", |
| @@ -93,9 +93,12 @@ const pidIsGone = (pid: number): boolean => { · 92 unmodified lines | ||
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | 95 | const waitUntilGone = async (pid: number): Promise<boolean> => { |
| 96 | − for (let index = 0; index < 100; index += 1) { | |
| 96 | + // kill(pid, 0) still succeeds for an exited-but-unreaped child, so poll on a | |
| 97 | + // real timer long enough for Node to reap it after the exit event. | |
| 98 | + const deadline = Date.now() + 5_000; | |
| 99 | + while (Date.now() < deadline) { | |
| 97 | 100 | if (pidIsGone(pid)) return true; |
| 98 | − await new Promise((resolve) => setImmediate(resolve)); | |
| 101 | + await new Promise((resolve) => setTimeout(resolve, 10)); | |
| 99 | 102 | } |
| 100 | 103 | return pidIsGone(pid); |
| 101 | 104 | }; |
| @@ -363,9 +363,11 @@ export const createWorkerdModuleRunner = ( · 362 unmodified lines | ||
| 363 | 363 | const state = processState; |
| 364 | 364 | processState = undefined; |
| 365 | 365 | if (!state) return; |
| 366 | − if (kill && !state.proc.killed) { | |
| 366 | + if (kill && state.proc.exitCode === null && state.proc.signalCode === null) { | |
| 367 | 367 | // workerd serve ignores SIGTERM in this version. SIGKILL is the verified immediate shutdown path. |
| 368 | + const exited = new Promise<void>((resolve) => state.proc.once("exit", () => resolve())); | |
| 368 | 369 | state.proc.kill("SIGKILL"); |
| 370 | + await exited; | |
| 369 | 371 | } |
| 370 | 372 | await closeServer(state.hostServer).catch(() => undefined); |
| 371 | 373 | await rm(state.tmp, { recursive: true, force: true }).catch(() => undefined); |
| @@ -45,5 +45,8 @@ · 44 unmodified lines | ||
| 45 | 45 | "effect": "catalog:", |
| 46 | 46 | "tsup": "catalog:", |
| 47 | 47 | "vitest": "catalog:" |
| 48 | + }, | |
| 49 | + "peerDependencies": { | |
| 50 | + "effect": "catalog:" | |
| 48 | 51 | } |
| 49 | 52 | } |