Mercurial > hg > truffle
diff mxtool/mx.py @ 12741:a5b5e1ebab81
Merge
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Sat, 09 Nov 2013 21:34:07 +0100 |
parents | 697ef4cf18c0 |
children | 68529068f08e |
line wrap: on
line diff
--- a/mxtool/mx.py Sat Nov 09 21:33:31 2013 +0100 +++ b/mxtool/mx.py Sat Nov 09 21:34:07 2013 +0100 @@ -1425,34 +1425,28 @@ else: preexec_fn = os.setsid - if not callable(out) and not callable(err) and timeout is None: - # The preexec_fn=os.setsid - p = subprocess.Popen(args, cwd=cwd, preexec_fn=preexec_fn, creationflags=creationflags, env=env) - _currentSubprocess = (p, args) + def redirect(stream, f): + for line in iter(stream.readline, ''): + f(line) + stream.close() + stdout = out if not callable(out) else subprocess.PIPE + stderr = err if not callable(err) else subprocess.PIPE + p = subprocess.Popen(args, cwd=cwd, stdout=stdout, stderr=stderr, preexec_fn=preexec_fn, creationflags=creationflags, env=env) + _currentSubprocess = (p, args) + if callable(out): + t = Thread(target=redirect, args=(p.stdout, out)) + t.daemon = True # thread dies with the program + t.start() + if callable(err): + t = Thread(target=redirect, args=(p.stderr, err)) + t.daemon = True # thread dies with the program + t.start() + if timeout is None or timeout == 0: retcode = waitOn(p) else: - def redirect(stream, f): - for line in iter(stream.readline, ''): - f(line) - stream.close() - stdout = out if not callable(out) else subprocess.PIPE - stderr = err if not callable(err) else subprocess.PIPE - p = subprocess.Popen(args, cwd=cwd, stdout=stdout, stderr=stderr, preexec_fn=preexec_fn, creationflags=creationflags, env=env) - _currentSubprocess = (p, args) - if callable(out): - t = Thread(target=redirect, args=(p.stdout, out)) - t.daemon = True # thread dies with the program - t.start() - if callable(err): - t = Thread(target=redirect, args=(p.stderr, err)) - t.daemon = True # thread dies with the program - t.start() - if timeout is None or timeout == 0: - retcode = waitOn(p) - else: - if get_os() == 'windows': - abort('Use of timeout not (yet) supported on Windows') - retcode = _waitWithTimeout(p, args, timeout) + if get_os() == 'windows': + abort('Use of timeout not (yet) supported on Windows') + retcode = _waitWithTimeout(p, args, timeout) except OSError as e: log('Error executing \'' + ' '.join(args) + '\': ' + str(e)) if _opts.verbose: @@ -2983,10 +2977,10 @@ # The path should always be p.name/dir. independent of where the workspace actually is. # So we use the parent folder of the project, whatever that is, to generate such a relative path. logicalWorkspaceRoot = os.path.dirname(p.dir) - binFolder = os.path.relpath(p.output_dir(), logicalWorkspaceRoot) - + binFolder = os.path.relpath(p.output_dir(), logicalWorkspaceRoot) + if _isAnnotationProcessorDependency(p): - refreshFile = os.path.relpath(join(p.dir, p.name + '.jar'), logicalWorkspaceRoot) + refreshFile = os.path.relpath(join(p.dir, p.name + '.jar'), logicalWorkspaceRoot) _genEclipseBuilder(out, p, 'Jar', 'archive ' + p.name, refresh=True, refreshFile=refreshFile, relevantResources=[binFolder], async=True, xmlIndent='', xmlStandalone='no') if projToDist.has_key(p.name): @@ -3068,18 +3062,18 @@ refreshScope = '${project}' else: refreshScope = '${working_set:<?xml version="1.0" encoding="UTF-8"?><resources><item path="' + refreshFile + '" type="1"/></resources>}' - - launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_RECURSIVE', 'value': 'false'}) + + launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_RECURSIVE', 'value': 'false'}) launchOut.element('stringAttribute', {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', 'value': refreshScope}) if relevantResources is not None: resources = '${working_set:<?xml version="1.0" encoding="UTF-8"?><resources>' for relevantResource in relevantResources: - resources += '<item path="' + relevantResource +'" type="2" />' + resources += '<item path="' + relevantResource + '" type="2" />' resources += '</resources>}' launchOut.element('stringAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE', 'value': resources}) - - + + launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON', 'value': consoleOn}) launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', 'value': 'true' if async else 'false'}) if logToFile: