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:
Joerg Bornemann
2011-11-07 12:36:52 +01:00
parent 6ac42268bf
commit a109f3011a

View File

@@ -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;
}