Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit121f6af

Browse files
committed
fix(cmd): allow improved errors during clone operation
Related to#383
1 parent55db0fc commit121f6af

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

‎git/cmd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,10 @@ def __del__(self):
309309
def__getattr__(self,attr):
310310
returngetattr(self.proc,attr)
311311

312-
defwait(self):
312+
defwait(self,stderr=None):
313313
"""Wait for the process and return its status code.
314314
315+
:param stderr: Previously read value of stderr, in case stderr is already closed.
315316
:warn: may deadlock if output or error pipes are used and not handled separately.
316317
:raise GitCommandError: if the return status is not 0"""
317318
status=self.proc.wait()
@@ -320,7 +321,7 @@ def read_all_from_possibly_closed_stream(stream):
320321
try:
321322
returnstream.read()
322323
exceptValueError:
323-
return''
324+
returnstderror''
324325

325326
ifstatus!=0:
326327
errstr=read_all_from_possibly_closed_stream(self.proc.stderr)

‎git/repo/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,8 +827,8 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
827827
ifprogress:
828828
handle_process_output(proc,None,progress.new_message_handler(),finalize_process)
829829
else:
830-
proc.communicate()
831-
finalize_process(proc)
830+
(stdout,stderr)=proc.communicate()
831+
finalize_process(proc,stderr=stderr)
832832
# end handle progress
833833
finally:
834834
ifprev_cwdisnotNone:

‎git/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ def get_user_id():
150150
return"%s@%s"% (getpass.getuser(),platform.node())
151151

152152

153-
deffinalize_process(proc):
153+
deffinalize_process(proc,**kwargs):
154154
"""Wait for the process (clone, fetch, pull or push) and handle its errors accordingly"""
155-
proc.wait()
155+
proc.wait(**kwargs)
156156

157157
#} END utilities
158158

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp