forked from qt-creator/qt-creator
process_ctrl_c_stub: forward exit code of the child process
If the child process cannot be started, return -1. Task-number: QTCREATORBUG-6458 Change-Id: I0392d883773f3037ac29dccc4d4a3c330efde838 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
@@ -102,16 +102,19 @@ int main(int argc, char **)
|
||||
free(strCommandLine);
|
||||
|
||||
if (!bSuccess)
|
||||
return 1;
|
||||
return -1;
|
||||
|
||||
MSG msg;
|
||||
DWORD dwExitCode = -1;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
if (msg.message == WM_DESTROY)
|
||||
dwExitCode = msg.wParam;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
return (int) msg.wParam;
|
||||
return (int)dwExitCode;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
@@ -148,7 +151,10 @@ DWORD WINAPI processWatcherThread(LPVOID lpParameter)
|
||||
{
|
||||
HANDLE hProcess = reinterpret_cast<HANDLE>(lpParameter);
|
||||
WaitForSingleObject(hProcess, INFINITE);
|
||||
PostMessage(hwndMain, WM_DESTROY, 0, 0);
|
||||
DWORD dwExitCode;
|
||||
if (!GetExitCodeProcess(hProcess, &dwExitCode))
|
||||
dwExitCode = -1;
|
||||
PostMessage(hwndMain, WM_DESTROY, dwExitCode, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user