Fix some responses from terminal sometimes leaking into shell on after kitten exit

Always do a roundtrip at kitten exit, except for special purpose
kittens. This slows down exit by one round trip time (capped at 2
seconds), however it ensures that we never get terminal response leak.

Fixes #9839
This commit is contained in:
Kovid Goyal
2026-04-10 15:14:38 +05:30
parent 4982173d3a
commit 5e158f90a7
12 changed files with 121 additions and 99 deletions

View File

@@ -32,13 +32,14 @@ func do_chunked_io(io_data *rc_io_data) (serialized_response []byte, err error)
// arrives, leading to the notification being sent to whatever is executed
// after us. Similarly no focus tracking.
lp, err := loop.New(loop.NoAlternateScreen, loop.NoRestoreColors, loop.NoInBandResizeNotifications, loop.NoFocusTracking)
if err != nil {
return
}
if io_data.on_key_event != nil {
lp.FullKeyboardProtocol()
} else {
lp.NoKeyboardStateChange()
}
if err != nil {
return
lp.NoRoundtripToTerminalOnExit = true
}
const (