PIProcess exit code for Windows
This commit is contained in:
@@ -183,10 +183,14 @@ void PIProcess::startProc(bool detached) {
|
||||
detached ? DETACHED_PROCESS /*CREATE_NEW_CONSOLE*/ : 0, // Creation flags
|
||||
0, // envcc, // Use environment
|
||||
wd.isEmpty() ? 0 : wd.data(), // Use working directory
|
||||
&(PRIVATE->si), // Pointer to STARTUPINFO structure
|
||||
&(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
|
||||
|
||||
Reference in New Issue
Block a user