diff --git a/cli/src/build.rs b/cli/src/build.rs index a1f3add2bc..26ddc1e37c 100644 --- a/cli/src/build.rs +++ b/cli/src/build.rs @@ -204,12 +204,15 @@ pub fn build_file<'a>( 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. cmd_result?; - // TODO change this to report whether there were errors or warnings! - let outcome = BuildOutcome::NoProblems; - Ok(BuiltFile { binary_path, outcome, diff --git a/cli/src/lib.rs b/cli/src/lib.rs index a86c3ec56c..d5a80eb53f 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -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)), + } } } }