Mercurial > hg > graal-compiler
changeset 15823:9acad98567dc
mx: fixed more spurious "error while killing subprocess" messages (GRAAL-350)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 21 May 2014 17:57:41 +0200 |
parents | 4900010a15d2 |
children | e6f93283387a |
files | mxtool/mx.py |
diffstat | 1 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mxtool/mx.py Wed May 21 16:41:57 2014 +0200 +++ b/mxtool/mx.py Wed May 21 17:57:41 2014 +0200 @@ -34,6 +34,7 @@ """ import sys, os, errno, time, subprocess, shlex, types, urllib2, contextlib, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, fnmatch +import multiprocessing import textwrap import socket import tarfile @@ -1844,14 +1845,22 @@ if _opts.killwithsigquit: _send_sigquit() + def is_alive(p): + if isinstance(p, subprocess.Popen): + return p.poll() is not None + assert isinstance(p, multiprocessing.Process), p + return p.is_alive() + for p, args in _currentSubprocesses: - try: - if get_os() == 'windows': - p.terminate() - else: - _kill_process_group(p.pid, signal.SIGKILL) - except BaseException as e: - log('error while killing subprocess {} "{}": {}'.format(p.pid, ' '.join(args), e)) + if is_alive(p): + try: + if get_os() == 'windows': + p.terminate() + else: + _kill_process_group(p.pid, signal.SIGKILL) + except BaseException as e: + if is_alive(p): + log('error while killing subprocess {} "{}": {}'.format(p.pid, ' '.join(args), e)) if _opts and _opts.verbose: import traceback @@ -2295,7 +2304,6 @@ t._d = None return sorted(tasks, compareTasks) - import multiprocessing cpus = multiprocessing.cpu_count() worklist = sortWorklist(tasks.values()) active = []