Only reset termios when user triggers reset action rather than in reponse to reset escape code

Fixes #9126
This commit is contained in:
Kovid Goyal
2025-10-18 08:53:50 +05:30
parent 0780eef7b1
commit c2fb9f14b5
2 changed files with 4 additions and 3 deletions

View File

@@ -563,9 +563,9 @@ class Child:
os.killpg(pgrp, s)
return True
def reset_termios_state(self) -> None:
def reset_termios_state(self, when: int = termios.TCSANOW) -> None:
if (s := getattr(self, 'initial_termios_state', None)) and self.child_fd is not None:
try:
termios.tcsetattr(self.child_fd, termios.TCSANOW, s)
termios.tcsetattr(self.child_fd, when, s)
except OSError:
pass