diff --git a/hyfetch/termenv.py b/hyfetch/termenv.py index b91bfcc4..a26289de 100644 --- a/hyfetch/termenv.py +++ b/hyfetch/termenv.py @@ -134,9 +134,11 @@ def handler(signum, frame): # Terminate with sequence terminator [\ or bell ^G if code.endswith('\x1b\\') or code.endswith('\a'): break - signal.alarm(0) except IOError: pass + finally: + # Disable alarm + signal.alarm(0) # Reset terminal back to normal mode (previously set to raw mode) termios.tcsetattr(fd, termios.TCSADRAIN, settings)