summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-19 06:56:50 +0100
committerhut <hut@lavabit.com>2013-02-19 06:56:50 +0100
commitc1760b60136b919682805ffd947b4da926654d61 (patch)
tree3ade5511ceb8dd33c892511fff5ce49f044296a9 /ranger
parentf4e5ce0899c379ebebb31897b756f8eb4fa59652 (diff)
downloadranger-c1760b60136b919682805ffd947b4da926654d61.tar.gz
core.loader: handle race condition when process quits unexpectedly
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/loader.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 926c11d1..e968b2eb 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -204,7 +204,12 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
         if not self.finished and not self.paused:
             if self.kill_on_pause:
                 self.finished = True
-                self.process.kill()
+                try:
+                    self.process.kill()
+                except OSError:
+                    # probably a race condition where the process finished
+                    # between the last poll()ing and this point.
+                    pass
                 return
             try:
                 self.process.send_signal(20)
@@ -225,7 +230,10 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
     def destroy(self):
         self.signal_emit('destroy', process=self.process, loader=self)
         if self.process:
-            self.process.kill()
+            try:
+                self.process.kill()
+            except OSError:
+                pass
 
 
 def safeDecode(string):