diff options
author | nfnty <git@nfnty.se> | 2017-01-20 16:09:19 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-01-21 23:09:24 +0100 |
commit | 1687e0f41f172cef6923f75f4c6f1038f19671dc (patch) | |
tree | 6b9fcb40ed3637cf13a8a9be9975504aadb5e90b /examples | |
parent | e53369588ee44a9fc4ec75228dc041448aa778d4 (diff) | |
download | ranger-1687e0f41f172cef6923f75f4c6f1038f19671dc.tar.gz |
linting: pylint: Enable `broad-except`, Improve logging
Handle exceptions explicitly to prevent unexpected errors from causing problems. Improve exception and notification logging.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/plugin_pmount.py | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/examples/plugin_pmount.py b/examples/plugin_pmount.py index d7c88349..38c4a17c 100644 --- a/examples/plugin_pmount.py +++ b/examples/plugin_pmount.py @@ -22,22 +22,19 @@ HOOK_INIT_OLD = ranger.api.hook_init def hook_init(fm): - try: - fm.execute_console("map {key} shell -p lsblk".format(key=LIST_MOUNTS_KEY)) - for disk in "abcdefgh": - fm.execute_console("map {key}{0} chain shell pmount sd{1}; cd /media/sd{1}".format( - disk.upper(), disk, key=MOUNT_KEY)) - fm.execute_console("map {key}{0} chain cd; chain shell pumount sd{1}".format( - disk.upper(), disk, key=UMOUNT_KEY)) - for part in "123456789": - fm.execute_console( - "map {key}{0}{1} chain shell pmount sd{0}{1}; cd /media/sd{0}{1}".format( - disk, part, key=MOUNT_KEY) - ) - fm.execute_console("map {key}{0}{1} chain cd; shell pumount sd{0}{1}".format( - disk, part, key=UMOUNT_KEY)) - except Exception: - pass + fm.execute_console("map {key} shell -p lsblk".format(key=LIST_MOUNTS_KEY)) + for disk in "abcdefgh": + fm.execute_console("map {key}{0} chain shell pmount sd{1}; cd /media/sd{1}".format( + disk.upper(), disk, key=MOUNT_KEY)) + fm.execute_console("map {key}{0} chain cd; chain shell pumount sd{1}".format( + disk.upper(), disk, key=UMOUNT_KEY)) + for part in "123456789": + fm.execute_console( + "map {key}{0}{1} chain shell pmount sd{0}{1}; cd /media/sd{0}{1}".format( + disk, part, key=MOUNT_KEY) + ) + fm.execute_console("map {key}{0}{1} chain cd; shell pumount sd{0}{1}".format( + disk, part, key=UMOUNT_KEY)) return HOOK_INIT_OLD(fm) |