@@ -525,8 +525,10 @@ def _get_fetch_info_from_stderr(self, proc, progress):
525
525
progress_handler = progress .new_message_handler ()
526
526
527
527
stderr_fetch = open (join (self .repo .git_dir , '%03i_debug_git-python_stderr' % self .fetch_no ), 'wb' )
528
- def my_progress_handler (line ):
529
- stderr_fetch .write ((line + '\n ' ).encode (defenc ))
528
+ for line in proc .stderr :
529
+ line = line .decode (defenc )
530
+ stderr_fetch .write ((line ).encode (defenc ))
531
+ line = line .rstrip ()
530
532
for pline in progress_handler (line ):
531
533
if line .startswith ('fatal:' ):
532
534
raise GitCommandError (("Error when fetching: %s" % line ,), 2 )
@@ -541,12 +543,13 @@ def my_progress_handler(line):
541
543
# end
542
544
543
545
# We are only interested in stderr here ...
544
- handle_process_output (proc , None , my_progress_handler , finalize_process )
546
+ finalize_process (proc )
545
547
stderr_fetch .close ()
546
548
547
549
# read head information
548
550
import shutil
549
- shutil .copyfile (join (self .repo .git_dir , 'FETCH_HEAD' ), join (self .repo .git_dir , '%03i_debug_git-python_FETCH_HEAD' % self .fetch_no ))
551
+ shutil .copyfile (join (self .repo .git_dir , 'FETCH_HEAD' ),
552
+ join (self .repo .git_dir , '%03i_debug_git-python_FETCH_HEAD' % self .fetch_no ))
550
553
self .fetch_no += 1
551
554
fp = open (join (self .repo .git_dir , 'FETCH_HEAD' ), 'rb' )
552
555
fetch_head_info = [l .decode (defenc ) for l in fp .readlines ()]
@@ -615,6 +618,7 @@ def fetch(self, refspec=None, progress=None, **kwargs):
615
618
args = [refspec ]
616
619
617
620
proc = self .repo .git .fetch (self , * args , with_extended_output = True , as_process = True , v = True , ** kwargs )
621
+ proc .stdout .close ()
618
622
res = self ._get_fetch_info_from_stderr (proc , progress or RemoteProgress ())
619
623
if hasattr (self .repo .odb , 'update_cache' ):
620
624
self .repo .odb .update_cache ()
@@ -630,6 +634,7 @@ def pull(self, refspec=None, progress=None, **kwargs):
630
634
:return: Please see 'fetch' method """
631
635
kwargs = add_progress (kwargs , self .repo .git , progress )
632
636
proc = self .repo .git .pull (self , refspec , with_extended_output = True , as_process = True , v = True , ** kwargs )
637
+ proc .stdout .close ()
633
638
res = self ._get_fetch_info_from_stderr (proc , progress or RemoteProgress ())
634
639
if hasattr (self .repo .odb , 'update_cache' ):
635
640
self .repo .odb .update_cache ()
0 commit comments