Skip to content
Snippets Groups Projects
Commit a109f301 authored by Joerg Bornemann's avatar Joerg Bornemann
Browse files

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
No related branches found
No related tags found
No related merge requests found
...@@ -102,16 +102,19 @@ int main(int argc, char **) ...@@ -102,16 +102,19 @@ int main(int argc, char **)
free(strCommandLine); free(strCommandLine);
if (!bSuccess) if (!bSuccess)
return 1; return -1;
MSG msg; MSG msg;
DWORD dwExitCode = -1;
while (GetMessage(&msg, NULL, 0, 0)) while (GetMessage(&msg, NULL, 0, 0))
{ {
if (msg.message == WM_DESTROY)
dwExitCode = msg.wParam;
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
return (int) msg.wParam; return (int)dwExitCode;
} }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...@@ -148,7 +151,10 @@ DWORD WINAPI processWatcherThread(LPVOID lpParameter) ...@@ -148,7 +151,10 @@ DWORD WINAPI processWatcherThread(LPVOID lpParameter)
{ {
HANDLE hProcess = reinterpret_cast<HANDLE>(lpParameter); HANDLE hProcess = reinterpret_cast<HANDLE>(lpParameter);
WaitForSingleObject(hProcess, INFINITE); 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; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment