Skip to content

Commit

Permalink
Better error reporting on failed build_cmd run
Browse files Browse the repository at this point in the history
When running the custom build command fails, this prints out a correct error
message, return code, stdout and stderr.
  • Loading branch information
tomassedovic authored and emberian committed Jan 29, 2014
1 parent c0bad6c commit 83e19eb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cargo-lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ def build(args, conf):
shutil.copy(os.path.join(os.path.dirname(crate_root), fname), libdir())

elif 'build_cmd' in b:
out = sh.Command(b["build_cmd"])()
try:
out = sh.Command(b["build_cmd"])()
except sh.ErrorReturnCode as e:
print "The build command for {} failed with exit code {}".format(
args['<path>'], e.exit_code)
print e.message
sys.exit(1)
if not out.startswith("cargo-lite: "):
raise Exception("malformed output in build_cmd's stdout")
if out.startswith("cargo-lite: artifacts"):
Expand Down

0 comments on commit 83e19eb

Please sign in to comment.