PIProcess exit code for Windows
This commit is contained in:
@@ -186,7 +186,11 @@ void PIProcess::startProc(bool detached) {
|
|||||||
&(PRIVATE->si), // Pointer to STARTUPINFO structure
|
&(PRIVATE->si), // Pointer to STARTUPINFO structure
|
||||||
&(PRIVATE->pi))) // Pointer to PROCESS_INFORMATION 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.hThread);
|
||||||
CloseHandle(PRIVATE->pi.hProcess);
|
CloseHandle(PRIVATE->pi.hProcess);
|
||||||
} else
|
} else
|
||||||
|
|||||||
Reference in New Issue
Block a user