summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/loader.py9
-rw-r--r--ranger/gui/color.py7
2 files changed, 12 insertions, 4 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index f4694eca..1f9ec9cf 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -130,7 +130,7 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
     finished = False
     process = None
     def __init__(self, args, descr, silent=False, read=False, input=None,
-            kill_on_pause=False):
+            kill_on_pause=False, popenArgs=None):
         SignalDispatcher.__init__(self)
         Loadable.__init__(self, self.generate(), descr)
         self.args = args
@@ -139,6 +139,7 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
         self.stdout_buffer = ""
         self.input = input
         self.kill_on_pause = kill_on_pause
+        self.popenArgs = popenArgs
 
     def generate(self):
         py3 = sys.version_info[0] >= 3
@@ -146,8 +147,10 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
             stdin = PIPE
         else:
             stdin = open(os.devnull, 'r')
-        self.process = process = Popen(self.args,
-                stdout=PIPE, stderr=PIPE, stdin=stdin)
+        popenArgs = {} if self.popenArgs is None else self.popenArgs
+        popenArgs['stdout'] = popenArgs['stderr'] = PIPE
+        popenArgs['stdin'] = stdin
+        self.process = process = Popen(self.args, **popenArgs)
         self.signal_emit('before', process=process, loader=self)
         if self.input:
             if py3:
diff --git a/ranger/gui/color.py b/ranger/gui/color.py
index 2fa68a33..89b58092 100644
--- a/ranger/gui/color.py
+++ b/ranger/gui/color.py
@@ -35,7 +35,12 @@ def get_color(fg, bg):
                 fg = DEFAULT_FOREGROUND
             if bg == -1:  # -1 is the "default" color
                 bg = DEFAULT_BACKGROUND
-            curses.init_pair(size, fg, bg)
+
+            try:
+                curses.init_pair(size, fg, bg)
+            except:
+                # If this fails too, colors are probably not supported
+                pass
         COLOR_PAIRS[key] = size
 
     return COLOR_PAIRS[key]