Commit ef0548c6 authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Fix core dump code for older psutil

The Python psutil library on ChromeDriver builder is an older version,
with a slightly different API.

Bug: chromedriver:2778
Change-Id: Ifb4da86b33225813a71a290fdea4f783c55fa0e2
Reviewed-on: https://chromium-review.googlesource.com/c/1471229Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632050}
parent c9f5aa50
...@@ -150,7 +150,13 @@ class ChromeDriver(object): ...@@ -150,7 +150,13 @@ class ChromeDriver(object):
chrome_processes = chromedriver_process.children() chrome_processes = chromedriver_process.children()
if len(chrome_processes) == 1: if len(chrome_processes) == 1:
# Remove core file size limit, then use SIGABRT to dump core. # Remove core file size limit, then use SIGABRT to dump core.
chrome_processes[0].rlimit( # Newer versions of psutil.Process have rlimit method, while older
# versions have set_rlimit method.
if hasattr(chrome_processes[0], 'rlimit'):
rlimit_method = chrome_processes[0].rlimit
else:
rlimit_method = chrome_processes[0].set_rlimit
rlimit_method(
psutil.RLIMIT_CORE, psutil.RLIMIT_CORE,
(psutil.RLIM_INFINITY, psutil.RLIM_INFINITY)) (psutil.RLIM_INFINITY, psutil.RLIM_INFINITY))
chrome_processes[0].send_signal(signal.SIGABRT) chrome_processes[0].send_signal(signal.SIGABRT)
......
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