Commit a109f301 authored by Joerg Bornemann's avatar Joerg Bornemann

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: default avatarOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@nokia.com>
parent 6ac42268
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment