mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
Flush terminal input after exit
A key release can arrive after Codex has begun shutting down, leaving enhanced-key CSI-u bytes queued for the parent shell. Reuse the existing platform-specific input-buffer flush after terminal restoration so those stale events are discarded before control returns to the shell.
This commit is contained in:
@@ -305,6 +305,9 @@ pub fn restore_after_exit() -> Result<()> {
|
||||
if let Err(err) = terminal_stderr::finish() {
|
||||
first_error.get_or_insert(err);
|
||||
}
|
||||
// Discard key events queued while shutdown was in progress so the parent shell does not
|
||||
// receive CSI-u sequences that were encoded before keyboard reporting was reset.
|
||||
flush_terminal_input_buffer();
|
||||
|
||||
match first_error {
|
||||
Some(err) => Err(err),
|
||||
|
||||
Reference in New Issue
Block a user