| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -309,9 +309,10 @@ def __del__(self): | |||
| 309 | 309 | def __getattr__(self, attr): | |
| 310 | 310 | return getattr(self.proc, attr) | |
| 311 | 311 | ||
| 312 | - def wait(self): | ||
| 312 | + def wait(self, stderr=None): | ||
| 313 | 313 | """Wait for the process and return its status code. | |
| 314 | 314 | ||
| 315 | + :param stderr: Previously read value of stderr, in case stderr is already closed. | ||
| 315 | 316 | :warn: may deadlock if output or error pipes are used and not handled separately. | |
| 316 | 317 | :raise GitCommandError: if the return status is not 0""" | |
| 317 | 318 | status = self.proc.wait() | |
@@ -320,7 +321,7 @@ def read_all_from_possibly_closed_stream(stream): | |||
| 320 | 321 | try: | |
| 321 | 322 | return stream.read() | |
| 322 | 323 | except ValueError: | |
| 323 | - return '' | ||
| 324 | + return stderr or '' | ||
| 324 | 325 | ||
| 325 | 326 | if status != 0: | |
| 326 | 327 | errstr = read_all_from_possibly_closed_stream(self.proc.stderr) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -827,8 +827,8 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs): | |||
| 827 | 827 | if progress: | |
| 828 | 828 | handle_process_output(proc, None, progress.new_message_handler(), finalize_process) | |
| 829 | 829 | else: | |
| 830 | - proc.communicate() | ||
| 831 | - finalize_process(proc) | ||
| 830 | + (stdout, stderr) = proc.communicate() | ||
| 831 | + finalize_process(proc, stderr=stderr) | ||
| 832 | 832 | # end handle progress | |
| 833 | 833 | finally: | |
| 834 | 834 | if prev_cwd is not None: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -150,9 +150,9 @@ def get_user_id(): | |||
| 150 | 150 | return "%s@%s" % (getpass.getuser(), platform.node()) | |
| 151 | 151 | ||
| 152 | 152 | ||
| 153 | - def finalize_process(proc): | ||
| 153 | + def finalize_process(proc, **kwargs): | ||
| 154 | 154 | """Wait for the process (clone, fetch, pull or push) and handle its errors accordingly""" | |
| 155 | - proc.wait() | ||
| 155 | + proc.wait(**kwargs) | ||
| 156 | 156 | ||
| 157 | 157 | #} END utilities | |
| 158 | 158 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments