Improved docs gen handling of OpenSCAD errors.

This commit is contained in:
Revar Desmera 2019-05-26 10:59:13 -07:00
parent 11aed06813
commit 0f5abbd2ae

View file

@ -202,6 +202,13 @@ class ImageProcessing(object):
print(script) print(script)
print("////////////////////////////////////////////////////") print("////////////////////////////////////////////////////")
print("") print("")
with open("FAILED.scad", "w") as f:
print("////////////////////////////////////////////////////", file=f)
print("// {}: {} for {}".format(libfile, scriptfile, imgfile), file=f)
print("////////////////////////////////////////////////////", file=f)
print(script, file=f)
print("////////////////////////////////////////////////////", file=f)
print("", file=f)
sys.exit(-1) sys.exit(-1)
tmpimgs.append(tmpimgfile) tmpimgs.append(tmpimgfile)
@ -248,8 +255,9 @@ class ImageProcessing(object):
else: else:
if targimgfile.endswith(".gif"): if targimgfile.endswith(".gif"):
cmpcmd = ["cmp", newimgfile, targimgfile] cmpcmd = ["cmp", newimgfile, targimgfile]
res = subprocess.call(cmpcmd) p = subprocess.Popen(cmpcmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
issame = res == 0 err = p.stdout.read()
issame = p.returncode == 0
else: else:
cmpcmd = [COMPARE, "-metric", "MAE", newimgfile, targimgfile, "null:"] cmpcmd = [COMPARE, "-metric", "MAE", newimgfile, targimgfile, "null:"]
p = subprocess.Popen(cmpcmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) p = subprocess.Popen(cmpcmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)