From abbf1ca698b12a58013586b76e089df7a944eeab Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 11 Mar 2022 17:35:27 +0100 Subject: [PATCH] Allow to get exit status from child processes --- libs/pbd/system_exec.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/pbd/system_exec.cc b/libs/pbd/system_exec.cc index b199f8aa13..70ea91b847 100644 --- a/libs/pbd/system_exec.cc +++ b/libs/pbd/system_exec.cc @@ -431,7 +431,11 @@ SystemExec::wait (int options) while (is_running()) { WaitForSingleObject(pid->hProcess, 40); } - return 0; + DWORD exit_code; + if (GetExitCodeProcess(pid->hProcess, &exit_code)) { + return exit_code; + } + return -1; } bool @@ -707,7 +711,7 @@ SystemExec::wait (int options) } } /* else the process is still running */ } - return status; + return WEXITSTATUS (status); } bool