Commit edd82a02 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[blinkpy] Add a special case for killpg on macOS

Calling killpg() on a process group whose leader is defunct causes a
permission error on macOS, in which case we try to collect the defunct
process.

(On Linux, this would be a no-op. kill() a zombie process is always a
no-op on both macOS and Linux.)

Fixed: 1140363
Change-Id: I3253f315c40fecd3b9ebb4ebe4d0d18bcf0636d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2488369
Auto-Submit: Robert Ma <robertma@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: default avatarDirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#819203}
parent fc03c541
......@@ -149,6 +149,13 @@ class Executive(object):
if error.errno == errno.ECHILD:
# Can't wait on a non-child process, but the kill worked.
return
if error.errno == errno.EPERM and \
kill_tree and sys.platform == 'darwin':
# Calling killpg on a process group whose leader is defunct
# causes a permission error on macOS, in which case we try to
# collect the defunct process.
if os.waitpid(pid, os.WNOHANG) == (0, 0):
return
raise
def _win32_check_running_pid(self, pid):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment