about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-01-30 01:16:49 +0100
committernfnty <git@nfnty.se>2017-01-30 01:19:17 +0100
commit02b5366f83660f2f8d4b80e761c28e92a0e92e2a (patch)
tree8fd452d41d42e155074743dc142ee136bf7da476
parent185c022e9364316b66bbee352409533bdd4457dc (diff)
downloadranger-02b5366f83660f2f8d4b80e761c28e92a0e92e2a.tar.gz
Improve shutdown error handling; Limit `VCSThread` wait
-rw-r--r--ranger/core/main.py2
-rw-r--r--ranger/ext/vcs/vcs.py4
-rw-r--r--ranger/gui/ui.py2
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()