@@ -38,6 +38,10 @@ class Git(object):
38
38
"""
39
39
__slots__ = ("_working_dir" , "cat_file_all" , "cat_file_header" )
40
40
41
+ # CONFIGURATION
42
+ # The size in bytes read from stdout when copying git's output to another stream
43
+ max_chunk_size = 1024 * 64
44
+
41
45
class AutoInterrupt (object ):
42
46
"""
43
47
Kill/Interrupt the stored process instance once this instance goes out of scope. It is
@@ -173,9 +177,11 @@ def execute(self, command,
173
177
If set to a file-like object, data produced by the git command will be
174
178
output to the given stream directly.
175
179
This feature only has any effect if as_process is False. Processes will
176
- always be created with a pipe due to issues with subprocess.
177
- This merely is a workaround as data will be copied from the
180
+ always be created with a pipe as subprocess.Popen can only accept system
181
+ file descriptors, not python objects ( such as StringIO ).
182
+ This merely is a workaround as the data will be copied from the
178
183
output pipe to the given output stream directly.
184
+ See also: Git.max_chunk_size
179
185
180
186
``**subprocess_kwargs``
181
187
Keyword arguments to be passed to subprocess.Popen. Please note that
@@ -227,7 +233,7 @@ def execute(self, command,
227
233
if output_stream is None :
228
234
stdout_value = proc .stdout .read ().rstrip () # strip trailing "\n"
229
235
else :
230
- max_chunk_size = 1024 * 64
236
+ max_chunk_size = self . max_chunk_size
231
237
while True :
232
238
chunk = proc .stdout .read (max_chunk_size )
233
239
output_stream .write (chunk )
0 commit comments