fix: Exit code getting in forwarder not working

This commit is contained in:
WerWolv
2025-12-22 12:53:39 +01:00
parent 64db392699
commit 8b53b36b20

View File

@@ -126,17 +126,18 @@ int launchExecutable() {
// Wait for the child process to exit
::WaitForSingleObject(pi.hProcess, INFINITE);
// Clean up
::CloseHandle(pi.hProcess);
::CloseHandle(pi.hThread);
::CloseHandle(hChildStdoutRead);
// Get the exit code of the child process
DWORD exitCode = 0;
if (::GetExitCodeProcess(pi.hProcess, &exitCode)) {
return static_cast<int>(exitCode);
} else {
return EXIT_FAILURE;
if (!::GetExitCodeProcess(pi.hProcess, &exitCode)) {
exitCode = EXIT_FAILURE;
}
// Clean up
::CloseHandle(pi.hProcess);
::CloseHandle(pi.hThread);
::CloseHandle(hChildStdoutRead);
return static_cast<int>(exitCode);
}
int main() {