about summary refs log tree commit diff stats
path: root/examples/plugin_pmount.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/plugin_pmount.py')
-rw-r--r--examples/plugin_pmount.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/plugin_pmount.py b/examples/plugin_pmount.py
index fe0adffb..6cd325f7 100644
--- a/examples/plugin_pmount.py
+++ b/examples/plugin_pmount.py
@@ -15,7 +15,8 @@ MOUNT_KEY = '<alt>m'
 UMOUNT_KEY = '<alt>M'
 LIST_MOUNTS_KEY = '<alt>N'
 
-old_hook_init = ranger.api.hook_init
+
+HOOK_INIT_OLD = ranger.api.hook_init
 
 
 def hook_init(fm):
@@ -33,6 +34,10 @@ def hook_init(fm):
                 )
                 fm.execute_console("map {key}{0}{1} chain cd; shell pumount sd{0}{1}".format(
                     disk, part, key=UMOUNT_KEY))
-    finally:
-        return old_hook_init(fm)
+    except Exception:
+        pass
+
+    return HOOK_INIT_OLD(fm)
+
+
 ranger.api.hook_init = hook_init