From cc6ded45c7915b142c61280dcc25d941a653a522 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 24 Aug 2017 13:01:23 +0800 Subject: minicargo build - Fix exit detection --- tools/minicargo/build.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/minicargo/build.cpp b/tools/minicargo/build.cpp index 4088147f..50f29db3 100644 --- a/tools/minicargo/build.cpp +++ b/tools/minicargo/build.cpp @@ -392,9 +392,14 @@ bool Builder::spawn_process(const StringList& args, const ::helpers::path& logfi posix_spawn_file_actions_destroy(&fa); int status = -1; waitpid(pid, &status, 0); - if( WEXITSTATUS(status) != 0 ) + if( status != 0 ) { - DEBUG("Compiler exited with non-zero exit status " << WEXITSTATUS(status)); + if( WIFEXITED(status) ) + DEBUG("Compiler exited with non-zero exit status " << WEXITSTATUS(status)); + else if( WIFSIGNALED(status) ) + DEBUG("Compiler was terminated with signal " << WSTOPSIG(status)); + else + DEBUG("Compiler terminated for unknown reason, status=" << status); return false; } #endif -- cgit v1.2.3