diff options
-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 |