fix(coding-agent): preserve final TUI frame on quit
This commit is contained in:
@@ -3208,7 +3208,8 @@ export class InteractiveMode {
|
||||
|
||||
/**
|
||||
* Gracefully shutdown the agent.
|
||||
* Emits shutdown event to extensions, then exits.
|
||||
* Stops the TUI before emitting shutdown events so extension UI cleanup cannot
|
||||
* repaint the final frame while the process is exiting.
|
||||
*/
|
||||
private isShuttingDown = false;
|
||||
|
||||
@@ -3216,17 +3217,13 @@ export class InteractiveMode {
|
||||
if (this.isShuttingDown) return;
|
||||
this.isShuttingDown = true;
|
||||
this.unregisterSignalHandlers();
|
||||
await this.runtimeHost.dispose();
|
||||
|
||||
// Wait for any pending renders to complete
|
||||
// requestRender() uses process.nextTick(), so we wait one tick
|
||||
await new Promise((resolve) => process.nextTick(resolve));
|
||||
|
||||
// Drain any in-flight Kitty key release events before stopping.
|
||||
// This prevents escape sequences from leaking to the parent shell over slow SSH.
|
||||
await this.ui.terminal.drainInput(1000);
|
||||
|
||||
this.stop();
|
||||
await this.runtimeHost.dispose();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user