Commit 80ab20e7 authored by tonyg@chromium.org's avatar tonyg@chromium.org

Make KillAllAdb robust to AccessDenied exceptions.

This error seems to pop up when adb is not currently running. It isn't clear to
me why we get that instead of NoSuchProcess, but in any case, this should allow
us to continue instead of aborting like in:
http://chromegw/i/chromium.perf/builders/Android%20Nexus5%20Perf/builds/1022/steps/device_status_check/logs/stdio

BUG=388885

Review URL: https://codereview.chromium.org/385733002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282525 0039d316-1c4b-4281-b951-d872f2087c98
parent 3609c963
...@@ -246,7 +246,7 @@ def KillAllAdb(): ...@@ -246,7 +246,7 @@ def KillAllAdb():
try: try:
if 'adb' in p.name: if 'adb' in p.name:
yield p yield p
except psutil.error.NoSuchProcess: except (psutil.error.NoSuchProcess, psutil.error.AccessDenied):
pass pass
for sig in [signal.SIGTERM, signal.SIGQUIT, signal.SIGKILL]: for sig in [signal.SIGTERM, signal.SIGQUIT, signal.SIGKILL]:
...@@ -255,12 +255,12 @@ def KillAllAdb(): ...@@ -255,12 +255,12 @@ def KillAllAdb():
print 'kill %d %d (%s [%s])' % (sig, p.pid, p.name, print 'kill %d %d (%s [%s])' % (sig, p.pid, p.name,
' '.join(p.cmdline)) ' '.join(p.cmdline))
p.send_signal(sig) p.send_signal(sig)
except psutil.error.NoSuchProcess: except (psutil.error.NoSuchProcess, psutil.error.AccessDenied):
pass pass
for p in GetAllAdb(): for p in GetAllAdb():
try: try:
print 'Unable to kill %d (%s [%s])' % (p.pid, p.name, ' '.join(p.cmdline)) print 'Unable to kill %d (%s [%s])' % (p.pid, p.name, ' '.join(p.cmdline))
except psutil.error.NoSuchProcess: except (psutil.error.NoSuchProcess, psutil.error.AccessDenied):
pass pass
......
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