From c1760b60136b919682805ffd947b4da926654d61 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 19 Feb 2013 06:56:50 +0100 Subject: core.loader: handle race condition when process quits unexpectedly --- ranger/core/loader.py | 12 ++++++++++-- 1 file 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): -- cgit 1.4.1-2-gfad0