about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-03-08 12:45:28 +0100
committertoonn <toonn@toonn.io>2021-03-08 12:45:28 +0100
commit12b3af22d5a22619053f91bd34d4df3fbebea136 (patch)
treecb74840d36a41a24d11cc1c73a25874177c01b9b /ranger
parent6196a6ac6c67b1fd8d31cce3c75cc8750a42a7fc (diff)
downloadranger-12b3af22d5a22619053f91bd34d4df3fbebea136.tar.gz
Check man is available before use
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/actions.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index d7a564c2..16bc8133 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -28,6 +28,7 @@ from ranger.core.loader import CommandLoader, CopyLoader
 from ranger.core.shared import FileManagerAware, SettingsAware
 from ranger.core.tab import Tab
 from ranger.ext.direction import Direction
+from ranger.ext.get_executables import get_executables
 from ranger.ext.keybinding_parser import key_to_string, construct_keybinding
 from ranger.ext.macrodict import MacroDict, MACRO_FAIL, macro_val
 from ranger.ext.next_available_filename import next_available_filename
@@ -968,17 +969,18 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
         pager.set_source(lines)
 
     def display_help(self):
-        manualpath = self.relpath('../doc/ranger.1')
-        if os.path.exists(manualpath):
-            process = self.run(['man', manualpath])
-            if process.poll() != 16:
-                return
-        process = self.run(['man', 'ranger'])
-        if process is None:
-            self.notify("Failed to show man page, check if man is installed", bad=True)
-            return
-        if process.poll() == 16:
-            self.notify("Could not find manpage.", bad=True)
+        if 'man' in get_executables():
+            manualpath = self.relpath('../doc/ranger.1')
+            if os.path.exists(manualpath):
+                process = self.run(['man', manualpath])
+                if process.poll() != 16:
+                    return
+            process = self.run(['man', 'ranger'])
+            if process.poll() == 16:
+                self.notify("Could not find manpage.", bad=True)
+        else:
+            self.notify("Failed to show man page, check if man is installed",
+                        bad=True)
 
     def display_log(self):
         logs = list(self.get_log())