ignore curses failures during termination (#1035503)

This commit is contained in:
Michal Hlavinka 2014-12-03 17:53:24 +01:00
parent e79ca3a91a
commit 5033dd8b94
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,44 @@
diff -up iotop-0.6/iotop/ui.py.noendcurses iotop-0.6/iotop/ui.py
--- iotop-0.6/iotop/ui.py.noendcurses 2014-12-03 17:50:38.941430261 +0100
+++ iotop-0.6/iotop/ui.py 2014-12-03 17:51:40.108064465 +0100
@@ -488,10 +488,14 @@ class IOTopUI(object):
self.win.refresh()
def run_iotop_window(win, options):
+ global terminating
+ terminating = False
if options.batch:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
else:
def clean_exit(*args, **kwargs):
+ global terminating
+ terminating = True
sys.exit(0)
signal.signal(signal.SIGINT, clean_exit)
signal.signal(signal.SIGTERM, clean_exit)
@@ -499,6 +503,7 @@ def run_iotop_window(win, options):
process_list = ProcessList(taskstats_connection, options)
ui = IOTopUI(win, process_list, options)
ui.run()
+ terminating = True
def run_iotop(options):
try:
@@ -520,6 +525,17 @@ Please do not file bugs on iotop about t
sys.exit(1)
else:
raise
+ except curses.error as e:
+ stre = str(e)
+ if terminating and stre.find('ERR')>=0 and (
+ stre.find('nocbreak()')>=0 or stre.find('endwin()')>=0
+ ):
+ pass
+ # endwin and nocbreak can cause error (and raise hard to catch
+ # exception) if iotop was running in the terminal and that
+ # terminal got closed while iotop was still running
+ else:
+ raise
#
# Profiling

View File

@ -1,7 +1,7 @@
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: iotop
Version: 0.6
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Top like utility for I/O
Group: Applications/System
@ -9,6 +9,9 @@ License: GPLv2+
URL: http://guichaz.free.fr/iotop/
Source0: http://guichaz.free.fr/iotop/files/%{name}-%{version}.tar.bz2
# rhbz#1035503
Patch1: iotop-0.6-noendcurses.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@ -17,6 +20,7 @@ Requires: python
%prep
%setup
%patch1 -p1 -b .noendcurses
%build
%{__python} setup.py build
@ -45,6 +49,9 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitelib}/*
%changelog
* Wed Dec 03 2014 Michal Hlavinka <mhlavink@redhat.com> - 0.6-4
- ignore curses failures during termination (#1035503)
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild