Skip to content

Commit

Permalink
UnixConsole.restore: fix/ignore restoring of signal in thread (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed authored Apr 28, 2019
1 parent 9df1fcb commit d1e0fd2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyrepl/unix_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,12 @@ def restore(self):
tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate)

if hasattr(self, 'old_sigwinch'):
signal.signal(signal.SIGWINCH, self.old_sigwinch)
del self.old_sigwinch
try:
signal.signal(signal.SIGWINCH, self.old_sigwinch)
del self.old_sigwinch
except ValueError:
# signal only works in main thread.
pass

def __sigwinch(self, signum, frame):
self.height, self.width = self.getheightwidth()
Expand Down

0 comments on commit d1e0fd2

Please sign in to comment.