When cargo errors, print an error about cargo.out.

Currently if cargo produces an error it's not obvious how to debug it.
Add a message telling the user to look at the cargo.out file, which
has its output.

Test: Ran on crates with and without errors
Change-Id: Ib681a8e87f60467c7425aed5f7e5277a0603bcc8
This commit is contained in:
Joel Galenson
2021-05-17 10:54:50 -07:00
parent 37f061b11a
commit 6bf54e3abb

View File

@@ -1280,7 +1280,10 @@ class Runner(object):
print('Running:', cmd) print('Running:', cmd)
with open(cargo_out, 'a') as out_file: with open(cargo_out, 'a') as out_file:
out_file.write('### Running: ' + cmd + '\n') out_file.write('### Running: ' + cmd + '\n')
os.system(cmd) ret = os.system(cmd)
if ret != 0:
print('*** There was an error while running cargo. ' +
'See the cargo.out file for details.')
if added_workspace: # restore original Cargo.toml if added_workspace: # restore original Cargo.toml
with open(cargo_toml, 'w') as out_file: with open(cargo_toml, 'w') as out_file:
out_file.writelines(cargo_toml_lines) out_file.writelines(cargo_toml_lines)