From 2039510856dc1785cb9d7b41e1890113271c7194 Mon Sep 17 00:00:00 2001 From: Kevin Chen Date: Mon, 23 Nov 2015 21:02:44 -0500 Subject: [PATCH] [Fix #74] nhc: Don't ignore Clang's return value. --- src/nhc.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/nhc.ml b/src/nhc.ml index db28d0a..ebb3532 100644 --- a/src/nhc.ml +++ b/src/nhc.ml @@ -23,10 +23,13 @@ let do_compile src_path bin_path keep_ast keep_il = let il_path = bin_path ^ ".cpp" in Out_channel.write_all il_path ~data:cpp else (); - let cpp_compile = "clang++ -Wall -pedantic -fsanitize=address -std=c++14 -O2 -xc++ - support.cpp" in - let ch = Unix.open_process_out cpp_compile in + let cxx = "clang++ -Wall -pedantic -fsanitize=address -std=c++14 -O2 -xc++ - support.cpp" in + let ch = Unix.open_process_out cxx in Out_channel.output_string ch cpp; - ignore(Unix.close_process_out ch) + if Unix.close_process_out ch <> Result.Ok( () ) then + failwith "Internal error: C++ compilation failed" + else (); + () let command = Command.basic