@@ -525,8 +525,10 @@ def _get_fetch_info_from_stderr(self, proc, progress):
525525progress_handler = progress .new_message_handler ()
526526
527527stderr_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 ()
530532for pline in progress_handler (line ):
531533if line .startswith ('fatal:' ):
532534raise GitCommandError (("Error when fetching: %s" % line ,),2 )
@@ -541,12 +543,13 @@ def my_progress_handler(line):
541543# end
542544
543545# We are only interested in stderr here ...
544- handle_process_output (proc , None , my_progress_handler , finalize_process )
546+ finalize_process (proc )
545547stderr_fetch .close ()
546548
547549# read head information
548550import 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 ))
550553self .fetch_no += 1
551554fp = open (join (self .repo .git_dir ,'FETCH_HEAD' ),'rb' )
552555fetch_head_info = [l .decode (defenc )for l in fp .readlines ()]
@@ -615,6 +618,7 @@ def fetch(self, refspec=None, progress=None, **kwargs):
615618args = [refspec ]
616619
617620proc = self .repo .git .fetch (self ,* args ,with_extended_output = True ,as_process = True ,v = True ,** kwargs )
621+ proc .stdout .close ()
618622res = self ._get_fetch_info_from_stderr (proc ,progress or RemoteProgress ())
619623if hasattr (self .repo .odb ,'update_cache' ):
620624self .repo .odb .update_cache ()
@@ -630,6 +634,7 @@ def pull(self, refspec=None, progress=None, **kwargs):
630634 :return: Please see 'fetch' method """
631635kwargs = add_progress (kwargs ,self .repo .git ,progress )
632636proc = self .repo .git .pull (self ,refspec ,with_extended_output = True ,as_process = True ,v = True ,** kwargs )
637+ proc .stdout .close ()
633638res = self ._get_fetch_info_from_stderr (proc ,progress or RemoteProgress ())
634639if hasattr (self .repo .odb ,'update_cache' ):
635640self .repo .odb .update_cache ()