openscad.py now quits if there are errors or warnings in the log.

This is because the exit status is not always set correctly.
This commit is contained in:
Chris Palmer 2021-02-08 16:03:59 +00:00
parent 57212b5701
commit 929d082b25
1 changed files with 5 additions and 0 deletions

View File

@ -33,12 +33,17 @@ def run_list(args, silent = False, verbose = False):
with open("openscad.log", "w") as log:
rc = subprocess.call(cmd, stdout = log, stderr = log)
log_file = "openscad.echo" if "openscad.echo" in cmd else "openscad.log"
bad = False
for line in open(log_file, "rt"):
if verbose or 'ERROR:' in line or 'WARNING:' in line:
bad = True
print(line[:-1])
if rc:
sys.exit(rc)
if bad:
sys.exit(1)
def run(*args):
run_list(list(args), False)