Commit eaceb8a9 authored by Ben Boeckel's avatar Ben Boeckel

paraview-mesa: fix usage of the kwsys Process API

Not waiting for the process to exit caused the exit code to be fetched
at the wrong time. Copy code structure from CMake for proper usage.
parent b74d73b1
......@@ -309,7 +309,31 @@ int main(int argc, char* argv[])
vtksysProcess_SetPipeShared(proc, vtksysProcess_Pipe_STDOUT, 1);
vtksysProcess_SetPipeShared(proc, vtksysProcess_Pipe_STDERR, 1);
int ret = vtksysProcess_GetExitValueByIndex(proc, 0);
vtksysProcess_WaitForExit(proc, nullptr);
// Extract the result of the command.
int const state = vtksysProcess_GetState(proc);
int ret = EXIT_FAILURE;
if (state == vtksysProcess_State_Exited)
ret = vtksysProcess_GetExitValue(proc);
else if (state == vtksysProcess_State_Exception)
const char* exception_str = vtksysProcess_GetExceptionString(proc);
error("exception occurred: ", exception_str);
else if (state == vtksysProcess_State_Error)
const char* error_str = vtksysProcess_GetErrorString(proc);
error("process error: ", error_str);
else if (state == vtksysProcess_State_Expired)
error("timeout error", nullptr);
// Cleanup.
return ret;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment