fix(coding-agent): restore terminal on SIGTERM

closes #5724
This commit is contained in:
Armin Ronacher
2026-06-15 00:47:35 +02:00
parent b5e13bcd8a
commit ba0ec61563
4 changed files with 97 additions and 3 deletions

View File

@@ -3362,7 +3362,9 @@ export class InteractiveMode {
private async shutdown(options?: { fromSignal?: boolean }): Promise<void> {
if (this.isShuttingDown) return;
this.isShuttingDown = true;
this.unregisterSignalHandlers();
// Keep signal handlers registered until terminal cleanup has completed.
// `signal-exit` checks the listener list during the same SIGTERM/SIGHUP
// dispatch and re-sends the signal if only its own listeners remain.
if (options?.fromSignal) {
// Signal-triggered shutdown (SIGTERM/SIGHUP). Emit extension cleanup
@@ -5742,7 +5744,6 @@ export class InteractiveMode {
}
stop(): void {
this.unregisterSignalHandlers();
if (this.settingsManager.getShowTerminalProgress()) {
this.ui.terminal.setProgress(false);
}
@@ -5760,5 +5761,6 @@ export class InteractiveMode {
this.ui.stop();
this.isInitialized = false;
}
this.unregisterSignalHandlers();
}
}