File tree 2 files changed +5
-1
lines changed
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -478,8 +478,8 @@ def prepare(self):
478
478
"""Get ready to run. Call restore when finished. You must not
479
479
write to the console in between the calls to prepare and
480
480
restore."""
481
- self .console .prepare ()
482
481
try :
482
+ self .console .prepare ()
483
483
self .arg = None
484
484
self .screeninfo = []
485
485
self .finished = 0
Original file line number Diff line number Diff line change @@ -359,6 +359,7 @@ def prepare(self):
359
359
except termios .error : # (25, 'Inappropriate ioctl for device')
360
360
# assert not os.fdopen(self.input_fd).isatty()
361
361
raise EOFError
362
+ self ._prepared = True
362
363
raw = self .__svtermstate .copy ()
363
364
raw .iflag |= termios .ICRNL
364
365
raw .iflag &= ~ (termios .BRKINT | termios .INPCK |
@@ -390,6 +391,9 @@ def prepare(self):
390
391
pass
391
392
392
393
def restore (self ):
394
+ if not hasattr (self , '_prepared' ):
395
+ return
396
+ del self ._prepared
393
397
self .__maybe_write_code (self ._rmkx )
394
398
self .flushoutput ()
395
399
tcsetattr (self .input_fd , termios .TCSADRAIN , self .__svtermstate )
You can’t perform that action at this time.
0 commit comments