Bug 1145364 - Use more portable ps command line for orphan cleanup; r=kmoir

This commit is contained in:
Geoff Brown 2015-03-20 13:50:14 -06:00
parent c951d17324
commit 488516879b
2 changed files with 17 additions and 16 deletions

View File

@ -289,22 +289,22 @@ class RefTest(object):
def _psInfo(line):
if pname in line:
log.info(line)
process = mozprocess.ProcessHandler(['ps', '-f', '--no-headers'],
process = mozprocess.ProcessHandler(['ps', '-f'],
processOutputLine=_psInfo)
process.run()
process.wait()
def _psKill(line):
parts = line.split()
pid = int(parts[0])
if len(parts) == 3 and parts[2] == pname and parts[1] == '1':
log.info("killing %s orphan with pid %d" % (pname, pid))
try:
os.kill(pid, getattr(signal, "SIGKILL", signal.SIGTERM))
except Exception as e:
log.info("Failed to kill process %d: %s" % (pid, str(e)))
process = mozprocess.ProcessHandler(['ps', '-o', 'pid,ppid,comm', '--no-headers'],
if len(parts) == 3 and parts[0].isdigit():
pid = int(parts[0])
if parts[2] == pname and parts[1] == '1':
log.info("killing %s orphan with pid %d" % (pname, pid))
try:
os.kill(pid, getattr(signal, "SIGKILL", signal.SIGTERM))
except Exception as e:
log.info("Failed to kill process %d: %s" % (pid, str(e)))
process = mozprocess.ProcessHandler(['ps', '-o', 'pid,ppid,comm'],
processOutputLine=_psKill)
process.run()
process.wait()

View File

@ -2033,18 +2033,19 @@ class Mochitest(MochitestUtilsMixin):
def _psInfo(line):
if pname in line:
self.log.info(line)
process = mozprocess.ProcessHandler(['ps', '-f', '--no-headers'],
process = mozprocess.ProcessHandler(['ps', '-f'],
processOutputLine=_psInfo)
process.run()
process.wait()
def _psKill(line):
parts = line.split()
pid = int(parts[0])
if len(parts) == 3 and parts[2] == pname and parts[1] == '1':
self.log.info("killing %s orphan with pid %d" % (pname, pid))
killPid(pid, self.log)
process = mozprocess.ProcessHandler(['ps', '-o', 'pid,ppid,comm', '--no-headers'],
if len(parts) == 3 and parts[0].isdigit():
pid = int(parts[0])
if parts[2] == pname and parts[1] == '1':
self.log.info("killing %s orphan with pid %d" % (pname, pid))
killPid(pid, self.log)
process = mozprocess.ProcessHandler(['ps', '-o', 'pid,ppid,comm'],
processOutputLine=_psKill)
process.run()
process.wait()