Skip to content

Include 'timeout' parameter in Git execute #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 16, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Run os.kill for all child pids even after some of them are down
Right now, we come out of the iteration in case of failure
while trying to kill a child pid. This may result in some of
the child pids staying alive.

Change-Id: I18d58fcefec2bbdae4ae9bf73594939ade241b52
  • Loading branch information
OswinNathanial authored and dpursehouse committed Oct 13, 2015
commit dbbcaf7a355e925911fa77e204dd2c38ee633c0f
5 changes: 4 additions & 1 deletion git/cmd.py
Original file line number Diff line number Diff line change
@@ -618,7 +618,10 @@ def _kill_process(pid):
try:
os.kill(pid, SIGKILL)
for child_pid in child_pids:
os.kill(child_pid, SIGKILL)
try:
os.kill(child_pid, SIGKILL)
except OSError:
pass
kill_check.set() # tell the main routine that the process was killed
except OSError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If os.kill throws OSError if the process to be killed doesn't exist, I fear that after os.kill(pid, SIGKILL), some of the child processes might already be down as pid. Right now, failure to kill the first child process, will prevent the others from being downed as well. Maybe something like that would help:

for child_pid in child_pids:
    try:
        os.kill(child_pid, SIGKILL)
    except OSError:
        pass

# It is possible that the process gets completed in the duration after timeout