diff options
author | hut <hut@lavabit.com> | 2009-12-28 19:23:54 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-12-28 22:15:11 +0100 |
commit | f6dc79db2689088c5f6459c745547abc412a9510 (patch) | |
tree | b1b8dbc5c8d6658ccc4279fb0dbd8622c1a04509 | |
parent | b8dda85b34872f0350e9be90f64c2b5467c4bac4 (diff) | |
download | ranger-f6dc79db2689088c5f6459c745547abc412a9510.tar.gz |
fixed waitpid_no_intr
-rw-r--r-- | ranger/applications.py | 12 | ||||
-rw-r--r-- | ranger/ext/waitpid_no_intr.py | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/ranger/applications.py b/ranger/applications.py index d71170c7..4c329a05 100644 --- a/ranger/applications.py +++ b/ranger/applications.py @@ -68,10 +68,14 @@ def run(*args, **kw): return process else: - if fm.ui: fm.ui.suspend() - p = Popen(args, **popen_kw) - waitpid_no_intr(p.pid) - if fm.ui: fm.ui.initialize() + if fm.ui: + fm.ui.suspend() + try: + p = Popen(args, **popen_kw) + waitpid_no_intr(p.pid) + finally: + if fm.ui: + fm.ui.initialize() return p def spawn(command, fm=None, suspend=True, wait=True): diff --git a/ranger/ext/waitpid_no_intr.py b/ranger/ext/waitpid_no_intr.py index 5ed79e04..c2063313 100644 --- a/ranger/ext/waitpid_no_intr.py +++ b/ranger/ext/waitpid_no_intr.py @@ -5,6 +5,8 @@ def waitpid_no_intr(pid): while True: try: return os.waitpid(pid, 0) + except KeyboardInterrupt: + continue except OSError as e: if e.errno == errno.EINTR: continue |