mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Report builder errors in stage2 properly
This commit is contained in:
parent
6703980121
commit
f7631b879f
@ -56,24 +56,30 @@ class Stage2(Command):
|
|||||||
|
|
||||||
error_ocurred = []
|
error_ocurred = []
|
||||||
|
|
||||||
|
def report_error(p):
|
||||||
|
error_ocurred.append(True)
|
||||||
|
if mtexe:
|
||||||
|
mtexe.terminate(), mtexe.wait()
|
||||||
|
log = p.log
|
||||||
|
log.flush()
|
||||||
|
log.seek(0)
|
||||||
|
raw = log.read()
|
||||||
|
sys.stderr.write(raw)
|
||||||
|
sys.stderr.write(b'\n')
|
||||||
|
self.info('\n\nFailed to build: %s. Waiting for other builds to complete before aborting...' % x)
|
||||||
|
|
||||||
def workers_running():
|
def workers_running():
|
||||||
running = False
|
running = False
|
||||||
for p in processes:
|
for p in processes:
|
||||||
if p.returncode is not None:
|
if p.returncode is not None:
|
||||||
|
if p.returncode != 0 and not error_ocurred:
|
||||||
|
report_error(p)
|
||||||
continue
|
continue
|
||||||
rc = p.poll()
|
rc = p.poll()
|
||||||
if rc is not None:
|
if rc is not None:
|
||||||
p.duration = int(time.time() - p.start_time)
|
p.duration = int(time.time() - p.start_time)
|
||||||
if rc != 0 and not error_ocurred:
|
if rc != 0 and not error_ocurred:
|
||||||
error_ocurred.append(True)
|
report_error(p)
|
||||||
log = p.log
|
|
||||||
log.flush()
|
|
||||||
log.seek(0)
|
|
||||||
sys.stderr.write(log.read())
|
|
||||||
sys.stderr.write(b'\n')
|
|
||||||
self.info('\n\nFailed to build: %s. Waiting for other builds to complete before aborting...' % x)
|
|
||||||
if mtexe:
|
|
||||||
mtexe.terminate(), mtexe.wait()
|
|
||||||
else:
|
else:
|
||||||
running = True
|
running = True
|
||||||
return running
|
return running
|
||||||
@ -86,7 +92,7 @@ class Stage2(Command):
|
|||||||
os.waitpid(-1, 0)
|
os.waitpid(-1, 0)
|
||||||
|
|
||||||
if error_ocurred:
|
if error_ocurred:
|
||||||
raise SystemExit(1)
|
raise SystemExit('One of the OS specific builders failed')
|
||||||
if mtexe and mtexe.poll() is None:
|
if mtexe and mtexe.poll() is None:
|
||||||
mtexe.terminate(), mtexe.wait()
|
mtexe.terminate(), mtexe.wait()
|
||||||
for p in sorted(processes, key=lambda p:p.duration):
|
for p in sorted(processes, key=lambda p:p.duration):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user