diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-12 23:09:54 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-13 02:04:18 +0200 |
commit | 85f38a1bbc8fc4b19ebf2a52a3640b59a5dcf9fe (patch) | |
tree | 4f8df05b1a0c0f9168e86743888fcaf92dbfab5f /git/remote.py | |
parent | 83645971b8e134f45bded528e0e0786819203252 (diff) | |
download | gitpython-85f38a1bbc8fc4b19ebf2a52a3640b59a5dcf9fe.tar.gz |
remote, #525: pump fetch-infos instead of GIL-read stderr
+ `handle_process_output()` accepts null-finalizer, to pump completely
stderr before raising any errors.
+ test: Enable `TestGit.test_environment()` on Windows (to checks stderr
consumption).
Diffstat (limited to 'git/remote.py')
-rw-r--r-- | git/remote.py | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/git/remote.py b/git/remote.py index 8a46b2c5..2b924aaf 100644 --- a/git/remote.py +++ b/git/remote.py @@ -630,25 +630,19 @@ class Remote(LazyMixin, Iterable): cmds = set(PushInfo._flag_map.keys()) & set(FetchInfo._flag_map.keys()) progress_handler = progress.new_message_handler() + handle_process_output(proc, None, progress_handler, finalizer=None, decode_streams=False) - stderr_text = None + stderr_text = progress.error_lines and '\n'.join(progress.error_lines) or '' + proc.wait(stderr=stderr_text) + if stderr_text: + log.warning("Error lines received while fetching: %s", stderr_text) - for line in proc.stderr: + for line in progress.other_lines: line = force_text(line) - for pline in progress_handler(line): - # END handle special messages - for cmd in cmds: - if len(line) > 1 and line[0] == ' ' and line[1] == cmd: - fetch_info_lines.append(line) - continue - # end find command code - # end for each comand code we know - # end for each line progress didn't handle - # end - if progress.error_lines(): - stderr_text = '\n'.join(progress.error_lines()) - - finalize_process(proc, stderr=stderr_text) + for cmd in cmds: + if len(line) > 1 and line[0] == ' ' and line[1] == cmd: + fetch_info_lines.append(line) + continue # read head information with open(join(self.repo.git_dir, 'FETCH_HEAD'), 'rb') as fp: |