From 0ec084e7058aea3bf828a54072a80c75999f32ad Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 19 Aug 2015 23:28:59 -0700 Subject: [PATCH] wrapper: on Unix, get the task exit status with WEXITSTATUS() How did the wrapper ever work on Unix? Seems like it would think that every task failed. --- samples/wrapper/wrapper.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/samples/wrapper/wrapper.cpp b/samples/wrapper/wrapper.cpp index a9e4263bba..7c06ad5fa9 100644 --- a/samples/wrapper/wrapper.cpp +++ b/samples/wrapper/wrapper.cpp @@ -807,7 +807,8 @@ int TASK::run(int argct, char** argvt) { return 0; } -// return true if task exited +// return true if task exited; in that case also return its exit status +// (zero means it completed successfully) // bool TASK::poll(int& status) { char buf[256]; @@ -847,6 +848,10 @@ bool TASK::poll(int& status) { boinc_msg_prefix(buf, sizeof(buf)), application.c_str(), final_cpu_time ); + + if (WIFEXITED(status)) { + status = WEXITSTATUS(status); + } if (final_cpu_time < current_cpu_time) { final_cpu_time = current_cpu_time; }