summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-08-04 12:04:31 +0200
committerhut <hut@lepus.uberspace.de>2015-08-04 12:04:31 +0200
commitb880d02d3aebb12eb1a12b9242ff643eefa24256 (patch)
tree85b98df6fda9d6cdcee9b2eb8ec95f15466bfc23
parent6e31e96f108a2339c52631e1d42a48e22234ad82 (diff)
downloadranger-b880d02d3aebb12eb1a12b9242ff643eefa24256.tar.gz
core.loader: allow passing additional arguments to Popen
-rw-r--r--ranger/core/loader.py9
1 files changed, 6 insertions, 3 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: