72f31d
diff -up iotop-0.6/iotop/ui.py.noendcurses iotop-0.6/iotop/ui.py
72f31d
--- iotop-0.6/iotop/ui.py.noendcurses	2014-12-03 17:50:38.941430261 +0100
72f31d
+++ iotop-0.6/iotop/ui.py	2014-12-03 17:51:40.108064465 +0100
72f31d
@@ -520,6 +525,17 @@ Please do not file bugs on iotop about t
72f31d
             sys.exit(1)
72f31d
         else:
72f31d
             raise
72f31d
+    except curses.error as e:
72f31d
+        stre = str(e)
72f31d
+        if stre.find('ERR')>=0 and (
72f31d
+            stre.find('nocbreak()')>=0 or stre.find('endwin()')>=0
72f31d
+            ):
72f31d
+            pass
72f31d
+            # endwin and nocbreak can cause error (and raise hard to catch 
72f31d
+            # exception) if iotop was running in the terminal and that 
72f31d
+            # terminal got closed while iotop was still running
72f31d
+        else:
72f31d
+            raise
72f31d
 
72f31d
 #
72f31d
 # Profiling