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

Commit08a0fad

Browse files
committed
Make sure that stderr is converted to bytes
remove stderr for a wait() that is not the GitPython wrapper.
1 parent46201b3 commit08a0fad

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

‎git/cmd.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,19 +307,28 @@ def __del__(self):
307307
def__getattr__(self,attr):
308308
returngetattr(self.proc,attr)
309309

310-
defwait(self,stderr=''):
310+
defwait(self,stderr=b''):
311311
"""Wait for the process and return its status code.
312312
313313
:param stderr: Previously read value of stderr, in case stderr is already closed.
314314
:warn: may deadlock if output or error pipes are used and not handled separately.
315315
:raise GitCommandError: if the return status is not 0"""
316+
317+
# stderr must be a bytes object as it will
318+
# combined with more data from the process and
319+
# decoded by the caller
320+
ifstderrisNone:
321+
stderr=b''
322+
eliftype(stderr)==unicode:
323+
stderr=stderr.encode(defenc)
324+
316325
status=self.proc.wait()
317326

318327
defread_all_from_possibly_closed_stream(stream):
319328
try:
320329
returnstderr+stream.read()
321330
exceptValueError:
322-
returnstderror''
331+
returnstderrorb''
323332

324333
ifstatus!=0:
325334
errstr=read_all_from_possibly_closed_stream(self.proc.stderr)
@@ -678,7 +687,7 @@ def _kill_process(pid):
678687
# strip trailing "\n"
679688
ifstderr_value.endswith(b"\n"):
680689
stderr_value=stderr_value[:-1]
681-
status=proc.wait(stderr=stderr_value)
690+
status=proc.wait()
682691
# END stdout handling
683692
finally:
684693
proc.stdout.close()

‎git/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,10 +772,10 @@ def done(self):
772772
self.cv.notify_all()
773773
self.cv.release()
774774

775-
defwait(self):
775+
defwait(self,stderr=b''):
776776
self.cv.acquire()
777777
whileself.count>0:
778-
self.cv.wait()
778+
self.cv.wait(strerr=stderr)
779779
self.cv.release()
780780

781781

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp