summary refs log tree commit diff stats
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
parentf4e5ce0899c379ebebb31897b756f8eb4fa59652 (diff)
downloadranger-c1760b60136b919682805ffd947b4da926654d61.tar.gz
core.loader: handle race condition when process quits unexpectedly
-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):
47'>147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221