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

Commit148959c

Browse files
committed
apveyor,#519: FIX incomplete Popen pump
+ The code in `_read_lines_from_fno()` was reading the stream only onceper invocation, so when input was larger than `mmap.PAGESIZE`, byteswere forgotten in the stream.+ Also set deamon-threads.
1 parentd12fdca commit148959c

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

‎git/cmd.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def _bchr(c):
6969
# Documentation
7070
## @{
7171

72-
defhandle_process_output(process,stdout_handler,stderr_handler,finalizer):
72+
def9(process,stdout_handler,stderr_handler,finalizer):
7373
"""Registers for notifications to lean that process output is ready to read, and dispatches lines to
7474
the respective line handlers. We are able to handle carriage returns in case progress is sent by that
7575
mean. For performance reasons, we only apply this to stderr.
@@ -193,14 +193,24 @@ def _deplete_buffer(fno, handler, buf_list, wg=None):
193193
else:
194194
# Oh ... probably we are on windows. select.select() can only handle sockets, we have files
195195
# The only reliable way to do this now is to use threads and wait for both to finish
196+
def_handle_lines(fd,handler,wg):
197+
forlineinfd:
198+
line=line.decode(defenc)
199+
iflineandhandler:
200+
handler(line)
201+
ifwg:
202+
wg.done()
203+
196204
# Since the finalizer is expected to wait, we don't have to introduce our own wait primitive
197205
# NO: It's not enough unfortunately, and we will have to sync the threads
198206
wg=WaitGroup()
199-
forfno, (handler,buf_list)infdmap.items():
207+
forfd,handlerinzip((process.stdout,process.stderr),
208+
(stdout_handler,stderr_handler)):
200209
wg.add(1)
201-
t=threading.Thread(target=lambda:_deplete_buffer(fno,handler,buf_list,wg))
210+
t=threading.Thread(target=_handle_lines,args=(fd,handler,wg))
211+
t.setDaemon(True)
202212
t.start()
203-
# end
213+
204214
# NOTE: Just joining threads can possibly fail as there is a gap between .start() and when it's
205215
# actually started, which could make the wait() call to just return because the thread is not yet
206216
# active

‎git/test/test_git.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,9 @@ def counter_stderr(line):
238238
stdin=None,
239239
stdout=subprocess.PIPE,
240240
stderr=subprocess.PIPE,
241-
shell=False)
241+
shell=False,
242+
creationflags=Git.CREATE_NO_WINDOWifsys.platform=='win32'else0,
243+
)
242244

243245
handle_process_output(proc,counter_stdout,counter_stderr,lambdaproc:proc.wait())
244246

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp