|
16 | 16 | 'with_exceptions', 'as_process', |
17 | 17 | 'output_stream' ) |
18 | 18 |
|
19 | | -extra = {} |
20 | | -# NOTE: Execution through a shell on windows appears to be slightly faster, but in fact |
21 | | -# I consider it a problem whenever complex strings are passed and *interpreted* |
22 | | -# by the shell beforehand. This can cause great confusion and reduces compatability |
23 | | -# between the OS which is why the shell should not be used ( unless it does not work |
24 | | -# otherwise ) |
25 | | -#if sys.platform == 'win32': |
26 | | -# extra = {'shell': False} |
| 19 | + |
27 | 20 |
|
28 | 21 | def dashify(string): |
29 | 22 | return string.replace('_', '-') |
@@ -140,7 +133,8 @@ def execute(self, command, |
140 | 133 | with_extended_output=False, |
141 | 134 | with_exceptions=True, |
142 | 135 | as_process=False, |
143 | | - output_stream=None |
| 136 | + output_stream=None, |
| 137 | + **subprocess_kwargs |
144 | 138 | ): |
145 | 139 | """ |
146 | 140 | Handles executing the command on the shell and consumes and returns |
@@ -183,7 +177,11 @@ def execute(self, command, |
183 | 177 | This merely is a workaround as data will be copied from the |
184 | 178 | output pipe to the given output stream directly. |
185 | 179 | |
186 | | - |
| 180 | + ``**subprocess_kwargs`` |
| 181 | + Keyword arguments to be passed to subprocess.Popen. Please note that |
| 182 | + some of the valid kwargs are already set by this method, the ones you |
| 183 | + specify may not be the same ones. |
| 184 | + |
187 | 185 | Returns:: |
188 | 186 | |
189 | 187 | str(output) # extended_output = False (Default) |
@@ -216,7 +214,7 @@ def execute(self, command, |
216 | 214 | stderr=subprocess.PIPE, |
217 | 215 | stdout=subprocess.PIPE, |
218 | 216 | close_fds=(os.name=='posix'),# unsupported on linux |
219 | | - **extra |
| 217 | + **subprocess_kwargs |
220 | 218 | ) |
221 | 219 | if as_process: |
222 | 220 | return self.AutoInterrupt(proc, command) |
|
0 commit comments