mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #1944 from mbedmicro/ctrl-c-traceback
Fixes the python traceback when the user does ctrl+c during compilationpull/1949/head
commit
2a4a02caa7
|
@ -41,7 +41,11 @@ CPU_COUNT_MIN = 1
|
||||||
def compile_worker(job):
|
def compile_worker(job):
|
||||||
results = []
|
results = []
|
||||||
for command in job['commands']:
|
for command in job['commands']:
|
||||||
_, _stderr, _rc = run_cmd(command, job['work_dir'])
|
try:
|
||||||
|
_, _stderr, _rc = run_cmd(command, job['work_dir'])
|
||||||
|
except KeyboardInterrupt as e:
|
||||||
|
raise ToolException
|
||||||
|
|
||||||
results.append({
|
results.append({
|
||||||
'code': _rc,
|
'code': _rc,
|
||||||
'output': _stderr,
|
'output': _stderr,
|
||||||
|
|
|
@ -38,9 +38,10 @@ def run_cmd(command, wd=None, redirect=False):
|
||||||
try:
|
try:
|
||||||
p = Popen(command, stdout=PIPE, stderr=STDOUT if redirect else PIPE, cwd=wd)
|
p = Popen(command, stdout=PIPE, stderr=STDOUT if redirect else PIPE, cwd=wd)
|
||||||
_stdout, _stderr = p.communicate()
|
_stdout, _stderr = p.communicate()
|
||||||
except:
|
except OSError as e:
|
||||||
print "[OS ERROR] Command: "+(' '.join(command))
|
print "[OS ERROR] Command: "+(' '.join(command))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
return _stdout, _stderr, p.returncode
|
return _stdout, _stderr, p.returncode
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue