diff --git a/infer/src/clang/Capture.re b/infer/src/clang/Capture.re index 77248ab18..1a463e781 100644 --- a/infer/src/clang/Capture.re +++ b/infer/src/clang/Capture.re @@ -110,15 +110,21 @@ let run_and_validate_clang_frontend ast_source => } }; -let run_clang clang_command read => +let run_clang clang_command read => { + let exit_with_error exit_code => { + Logging.stderr + "Error: the following clang command did not run successfully:@\n %s@\n" clang_command; + exit exit_code + }; /* NOTE: exceptions will propagate through without exiting here */ switch (with_process_in clang_command read) { | (res, Unix.WEXITED 0) => res | (_, Unix.WEXITED n) => /* exit with the same error code as clang in case of compilation failure */ - exit n - | _ => exit 1 - }; + exit_with_error n + | _ => exit_with_error 1 + } +}; let run_plugin_and_frontend source_path frontend clang_args => { let clang_command = ClangCommand.command_to_run (ClangCommand.with_plugin_args clang_args); diff --git a/infer/src/clang/ClangWrapper.re b/infer/src/clang/ClangWrapper.re index 5b0cabe69..a5364049f 100644 --- a/infer/src/clang/ClangWrapper.re +++ b/infer/src/clang/ClangWrapper.re @@ -78,10 +78,10 @@ let exec_action_item = | ClangError error => { /* An error in the output of `clang -### ...`. Outputs the error and fail. This is because `clang -###` pretty much never fails, but warns of failures on stderr instead. */ - Logging.err "%s" error; + Logging.stderr "%s@." error; exit 1 } - | ClangWarning warning => Logging.err "%s@\n" warning + | ClangWarning warning => Logging.stderr "%s@\n" warning | Command clang_cmd => Capture.capture clang_cmd; let exe args xx_suffix => {