File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,18 @@ def __init__(
508
508
# Commands that will run at the beginning of the command loop
509
509
self ._startup_commands : list [str ] = []
510
510
511
+ # Store initial termios settings to restore after each command.
512
+ # This is a faster way of accomplishing what "stty sane" does.
513
+ self ._initial_termios_settings = None
514
+ if not sys .platform .startswith ('win' ) and self .stdin .isatty ():
515
+ try :
516
+ import termios
517
+
518
+ self ._initial_termios_settings = termios .tcgetattr (self .stdin .fileno ())
519
+ except (ImportError , termios .error ):
520
+ # This can happen if termios isn't available or stdin is a pseudo-TTY
521
+ pass
522
+
511
523
# If a startup script is provided and exists, then execute it in the startup commands
512
524
if startup_script :
513
525
startup_script = os .path .abspath (os .path .expanduser (startup_script ))
You can’t perform that action at this time.
0 commit comments