propagate return code from C compiler
This commit is contained in:
parent
94677bc79e
commit
4ae55322bb
10
jtlc
10
jtlc
@ -40,12 +40,12 @@ def main(argv):
|
||||
ofname = m.group(1) + '.o'
|
||||
else:
|
||||
ofname = s + '.o'
|
||||
do_compile(args, tfname, ofname)
|
||||
success = do_compile(args, tfname, ofname)
|
||||
ofiles.append(ofname)
|
||||
os.unlink(tfname)
|
||||
|
||||
if success and not args.c:
|
||||
do_link(args, ofiles)
|
||||
success = do_link(args, ofiles)
|
||||
|
||||
return 0 if success else 2
|
||||
|
||||
@ -60,14 +60,16 @@ def build(args, source, dest):
|
||||
|
||||
def do_compile(args, source_fname, ofname):
|
||||
Popen(['grep', '-n', '.', source_fname]).wait()
|
||||
Popen(['gcc', '-o', ofname, '-c', source_fname]).wait()
|
||||
rc = Popen(['gcc', '-o', ofname, '-c', source_fname]).wait()
|
||||
return rc == 0
|
||||
|
||||
def do_link(args, ofiles):
|
||||
cmd = ['gcc']
|
||||
if args.output_file is not None:
|
||||
cmd += ['-o', args.output_file]
|
||||
cmd += ofiles
|
||||
Popen(cmd).wait()
|
||||
rc = Popen(cmd).wait()
|
||||
return rc == 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
|
Loading…
x
Reference in New Issue
Block a user