PIProcess exit code for Windows

This commit is contained in:
2023-04-25 17:15:00 +03:00
parent f503e85507
commit 3ab57eea88

View File

@@ -186,7 +186,11 @@ void PIProcess::startProc(bool detached) {
&(PRIVATE->si), // Pointer to STARTUPINFO structure
&(PRIVATE->pi))) // Pointer to PROCESS_INFORMATION structure
{
if (!detached) WaitForSingleObject(PRIVATE->pi.hProcess, INFINITE);
if (!detached) {
WaitForSingleObject(PRIVATE->pi.hProcess, INFINITE);
DWORD code = -1;
if (GetExitCodeProcess(PRIVATE->pi.hProcess, &code) != 0) exit_code = code;
}
CloseHandle(PRIVATE->pi.hThread);
CloseHandle(PRIVATE->pi.hProcess);
} else