fix: use Effect.ignore instead of Effect.asVoid in killDirectChild to prevent SIGKILL phase short-circuit
Effect.asVoid only discards the success value but does not suppress errors. When child.kill fails (e.g., child already exited), the error propagates through Effect.all, causing the SIGTERM phase to fail and short-circuiting the SIGKILL escalation phase. This leaves orphaned serve processes alive. Effect.ignore both discards the value and suppresses errors, making killDirectChild infallible and allowing the full kill chain to complete. Also fix the same issue in the Windows path of killOpenCodeProcessGroup.
This commit is contained in:
1 file changed
+2
-2
@@ -450,7 +450,7 @@ const makeOpenCodeRuntime = Effect.gen(function* () {
|
||||
|
||||
const killOpenCodeProcessGroup = (signal: NodeJS.Signals) =>
|
||||
process.platform === "win32"
|
||||
? child.kill({ killSignal: signal, forceKillAfter: "1 second" }).pipe(Effect.asVoid)
|
||||
? child.kill({ killSignal: signal, forceKillAfter: "1 second" }).pipe(Effect.ignore)
|
||||
: Effect.sync(() => {
|
||||
try {
|
||||
process.kill(-Number(child.pid), signal);
|
||||
@@ -461,7 +461,7 @@ const makeOpenCodeRuntime = Effect.gen(function* () {
|
||||
}
|
||||
});
|
||||
const killDirectChild = (signal: NodeJS.Signals) =>
|
||||
child.kill({ killSignal: signal, forceKillAfter: "1 second" }).pipe(Effect.asVoid);
|
||||
child.kill({ killSignal: signal, forceKillAfter: "1 second" }).pipe(Effect.ignore);
|
||||
const killMatchingServeProcesses = (signal: NodeJS.Signals) =>
|
||||
terminateMatchingOpenCodeServeProcesses({
|
||||
binaryPath: input.binaryPath,
|
||||
|
||||
Reference in new issue
Block a user