improve error handling
This commit is contained in:
parent
6248dc554d
commit
05758a1557
20
jtlc
20
jtlc
@ -27,22 +27,24 @@ def main(argv):
|
|||||||
sys.stderr.write(argv[0] + ': no input files\n')
|
sys.stderr.write(argv[0] + ': no input files\n')
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
success = True
|
||||||
ofiles = []
|
ofiles = []
|
||||||
for s in args.sources:
|
for s in args.sources:
|
||||||
tf = tempfile.NamedTemporaryFile(suffix = '.c', delete = False)
|
tf = tempfile.NamedTemporaryFile(suffix = '.c', delete = False)
|
||||||
tfname = tf.name
|
tfname = tf.name
|
||||||
build(args, s, tf)
|
success = build(args, s, tf)
|
||||||
tf.close()
|
tf.close()
|
||||||
m = re.match('(.*)\.jtl', s)
|
if success:
|
||||||
if m is not None:
|
m = re.match('(.*)\.jtl', s)
|
||||||
ofname = m.group(1) + '.o'
|
if m is not None:
|
||||||
else:
|
ofname = m.group(1) + '.o'
|
||||||
ofname = s + '.o'
|
else:
|
||||||
do_compile(args, tfname, ofname)
|
ofname = s + '.o'
|
||||||
|
do_compile(args, tfname, ofname)
|
||||||
|
ofiles.append(ofname)
|
||||||
os.unlink(tfname)
|
os.unlink(tfname)
|
||||||
ofiles.append(ofname)
|
|
||||||
|
|
||||||
if not args.c:
|
if success and not args.c:
|
||||||
do_link(args, ofiles)
|
do_link(args, ofiles)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user