From 363bf092547f8bdacba77d34556f848eeab402ef Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Thu, 2 Apr 2015 23:56:15 +0200 Subject: [PATCH] progressbar.py: Ignore 'inappropriate ioctl for device' exceptions when resizing window. --- debian/tools/progressbar.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/debian/tools/progressbar.py b/debian/tools/progressbar.py index 6b228c6b..14679b0e 100644 --- a/debian/tools/progressbar.py +++ b/debian/tools/progressbar.py @@ -29,9 +29,14 @@ import termios def _sig_winch(signum=None, frame=None): """Signal handler for SIGWINCH.""" global _term_width - h, w, hp, wp = struct.unpack('HHHH', fcntl.ioctl(sys.stdout.fileno(), - termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0))) - _term_width = w + try: + h, w, hp, wp = struct.unpack('HHHH', fcntl.ioctl(sys.stdout.fileno(), + termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0))) + _term_width = w + except IOError: + # ignore 'IOError: [Errno 25] Inappropriate ioctl for device', + # which can occur when resizing the window while the output is redirected + pass try: _sig_winch()