From 02b5366f83660f2f8d4b80e761c28e92a0e92e2a Mon Sep 17 00:00:00 2001 From: nfnty Date: Mon, 30 Jan 2017 01:16:49 +0100 Subject: Improve shutdown error handling; Limit `VCSThread` wait --- ranger/core/main.py | 2 ++ ranger/ext/vcs/vcs.py | 4 ++-- ranger/gui/ui.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ranger/core/main.py b/ranger/core/main.py index 2cf9470a..8ebce9b5 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -183,6 +183,8 @@ https://github.com/hut/ranger/issues else: exit_code = ex.code finally: + if exit_msg: + LOG.critical(exit_msg) try: fm.ui.destroy() except (AttributeError, NameError): diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index 64dec6a1..18077c6d 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -479,10 +479,10 @@ class VcsThread(threading.Thread): # pylint: disable=too-many-instance-attribut def stop(self): """Stop thread synchronously""" self._stop.set() - self.paused.wait() + self.paused.wait(5) self._advance.set() self._awoken.set() - self.stopped.wait() + self.stopped.wait(1) def pause(self): """Pause thread""" diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index c3bc8539..1a930a23 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -133,7 +133,7 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method """Turn off curses""" if 'vcsthread' in self.__dict__: self.vcsthread.pause() - self.vcsthread.paused.wait() + self.vcsthread.paused.wait(5) self.win.keypad(0) curses.nocbreak() -- cgit 1.4.1-2-gfad0