feat(cli): do not run executable if build failed

This commit is contained in:
rvcas 2021-07-03 14:23:21 -04:00
parent a0deaa84e6
commit 3fa5b4363e
2 changed files with 10 additions and 4 deletions

View file

@ -204,12 +204,15 @@ pub fn build_file<'a>(
let total_time = compilation_start.elapsed().unwrap(); let total_time = compilation_start.elapsed().unwrap();
// TODO change this to report whether there were errors or warnings!
let outcome = match &cmd_result {
Ok(exit_status) if exit_status.success() => BuildOutcome::NoProblems,
_ => BuildOutcome::Errors,
};
// If the cmd errored out, return the Err. // If the cmd errored out, return the Err.
cmd_result?; cmd_result?;
// TODO change this to report whether there were errors or warnings!
let outcome = BuildOutcome::NoProblems;
Ok(BuiltFile { Ok(BuiltFile {
binary_path, binary_path,
outcome, outcome,

View file

@ -231,7 +231,10 @@ pub fn build(target: &Triple, matches: &ArgMatches, config: BuildConfig) -> io::
} }
} }
roc_run(cmd.current_dir(original_cwd)) match outcome {
BuildOutcome::Errors => Ok(2),
_ => roc_run(cmd.current_dir(original_cwd)),
}
} }
} }
} }