improve error handling

This commit is contained in:
Josh Holtrop 2011-08-30 16:10:13 -04:00
parent 6248dc554d
commit 05758a1557

8
jtlc
View File

@ -27,22 +27,24 @@ def main(argv):
sys.stderr.write(argv[0] + ': no input files\n')
return 1
success = True
ofiles = []
for s in args.sources:
tf = tempfile.NamedTemporaryFile(suffix = '.c', delete = False)
tfname = tf.name
build(args, s, tf)
success = build(args, s, tf)
tf.close()
if success:
m = re.match('(.*)\.jtl', s)
if m is not None:
ofname = m.group(1) + '.o'
else:
ofname = s + '.o'
do_compile(args, tfname, ofname)
os.unlink(tfname)
ofiles.append(ofname)
os.unlink(tfname)
if not args.c:
if success and not args.c:
do_link(args, ofiles)
return 0