mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Handle closed TUI input stream as shutdown (#17430)
Addresses #17276 Problem: Closing the terminal while the TUI input stream is pending could leave the app outside the normal shutdown path, which is risky when an approval prompt is active. Solution: Treat a closed TUI input stream as ShutdownFirst so existing thread shutdown behavior cancels pending work and approvals before exit.
This commit is contained in:
committed by
GitHub
Unverified
parent
0bdeab330b
commit
51d58c56d5
@@ -3940,10 +3940,15 @@ impl App {
|
||||
}
|
||||
AppRunControl::Continue
|
||||
}
|
||||
Some(event) = tui_events.next() => {
|
||||
match app.handle_tui_event(tui, &mut app_server, event).await {
|
||||
Ok(control) => control,
|
||||
Err(err) => break Err(err),
|
||||
event = tui_events.next() => {
|
||||
if let Some(event) = event {
|
||||
match app.handle_tui_event(tui, &mut app_server, event).await {
|
||||
Ok(control) => control,
|
||||
Err(err) => break Err(err),
|
||||
}
|
||||
} else {
|
||||
tracing::warn!("terminal input stream closed; shutting down active thread");
|
||||
app.handle_exit_mode(&mut app_server, ExitMode::ShutdownFirst).await
|
||||
}
|
||||
}
|
||||
app_server_event = app_server.next_event(), if listen_for_app_server_events => {
|
||||
|
||||
Reference in New Issue
Block a user