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-10-04 01:21:55 +0200
commita14663243487dfe62e6bf16dddeb2a0fe3885d5d (patch)
tree9fdcf9a3d4637b6f76780aac52db05d35eab7917
parent779805dbc51e4684eae9ca6a579acd66ed8463b6 (diff)
downloadranger-a14663243487dfe62e6bf16dddeb2a0fe3885d5d.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: