mirror of
https://github.com/openai/codex.git
synced 2026-11-13 21:30:47 +00:00
Forward repeated signals through the npm wrapper (#61221)
## Why The npm wrapper's spawn fallback stopped forwarding signals after the first one, preventing a second signal from interrupting a child's graceful shutdown. ## What changed Remove the `child.killed` guard so the wrapper continues forwarding `SIGINT`, `SIGTERM`, and `SIGHUP` until the child exits. ## Testing Add a regression test that forces the spawn fallback and verifies a running child receives a second `SIGTERM` and its numeric exit status is preserved. GitOrigin-RevId: be96e784e2e4f419c43a5897d264f55fcdfd625f
This commit is contained in:
@@ -258,14 +258,9 @@ child.on("error", (err) => {
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
// Forward common termination signals to the child so that it shuts down
|
||||
// gracefully. In the handler we temporarily disable the default behavior of
|
||||
// exiting immediately; once the child has been signaled we simply wait for
|
||||
// its exit event which will in turn terminate the parent (see below).
|
||||
// Keep forwarding signals until the child exits so a second signal can
|
||||
// interrupt a graceful shutdown.
|
||||
const forwardSignal = (signal) => {
|
||||
if (child.killed) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
child.kill(signal);
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user