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

Commitd3a7282

Browse files
author
Cory Johns
committed
[#5330] Ensure wait() is called on git processes
1 parent5869c5c commitd3a7282

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

‎git/cmd.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def __del__(self):
8080
# try to kill it
8181
try:
8282
os.kill(self.proc.pid,2)# interrupt signal
83+
self.proc.wait()# ensure process goes away
8384
exceptAttributeError:
8485
# try windows
8586
# for some reason, providing None for stdout/stderr still prints something. This is why

‎git/objects/commit.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
Actor,
99
Iterable,
1010
Stats,
11+
finalize_process
1112
)
1213
fromgit.diffimportDiffable
1314
fromtreeimportTree
@@ -251,6 +252,8 @@ def _iter_from_process_or_stream(cls, repo, proc_or_stream):
251252
assertlen(hexsha)==40,"Invalid line: %s"%hexsha
252253
yieldCommit(repo,hex_to_bin(hexsha))
253254
# END for each line in stream
255+
ifhas_attr(proc_or_stream,'wait'):
256+
finalize_process(proc_or_stream)
254257

255258

256259
@classmethod

‎git/remote.py‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
TagReference
2525
)
2626

27-
fromgit.utilimportjoin_path
27+
fromgit.utilimport (
28+
join_path,
29+
finalize_process
30+
)
2831
fromgitdb.utilimportjoin
2932

3033
importre
@@ -58,18 +61,6 @@ def digest_process_messages(fh, progress):
5861
# END while file is not done reading
5962
returndropped_lines
6063

61-
deffinalize_process(proc):
62-
"""Wait for the process (clone, fetch, pull or push) and handle its errors accordingly"""
63-
try:
64-
proc.wait()
65-
exceptGitCommandError,e:
66-
# if a push has rejected items, the command has non-zero return status
67-
# a return status of 128 indicates a connection error - reraise the previous one
68-
ifproc.poll()==128:
69-
raise
70-
pass
71-
# END exception handling
72-
7364
defadd_progress(kwargs,git,progress):
7465
"""Add the --progress flag to the given kwargs dict if supported by the
7566
git command. If the actual progress in the given progress instance is not

‎git/repo/base.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66

77
fromgit.excimportInvalidGitRepositoryError,NoSuchPathError
88
fromgit.cmdimportGit
9-
fromgit.utilimportActor
9+
fromgit.utilimport (
10+
Actor,
11+
finalize_process
12+
)
1013
fromgit.refsimport*
1114
fromgit.indeximportIndexFile
1215
fromgit.objectsimport*
1316
fromgit.configimportGitConfigParser
1417
fromgit.remoteimport (
1518
Remote,
1619
digest_process_messages,
17-
finalize_process,
1820
add_progress
1921
)
2022

@@ -541,6 +543,7 @@ def untracked_files(self):
541543
untracked_files.append(untracked_info.replace("#\t","").rstrip())
542544
# END for each utracked info line
543545
# END for each line
546+
finalize_process(proc)
544547
returnuntracked_files
545548

546549
@property

‎git/util.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ def get_user_id():
121121
# END get username from login
122122
return"%s@%s"% (username,platform.node())
123123

124+
deffinalize_process(proc):
125+
"""Wait for the process (clone, fetch, pull or push) and handle its errors accordingly"""
126+
try:
127+
proc.wait()
128+
exceptGitCommandError,e:
129+
# if a push has rejected items, the command has non-zero return status
130+
# a return status of 128 indicates a connection error - reraise the previous one
131+
ifproc.poll()==128:
132+
raise
133+
pass
134+
# END exception handling
135+
124136
#} END utilities
125137

126138
#{ Classes

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp