diff --git a/Contrib/nsExec/nsexec.c b/Contrib/nsExec/nsexec.c index 372d2e98..92281cf5 100644 --- a/Contrib/nsExec/nsexec.c +++ b/Contrib/nsExec/nsexec.c @@ -439,11 +439,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine if (Ret) { - do - { - GetExitCodeProcess(pi.hProcess, &Ret); - Sleep(LOOPTIMEOUT); - } while ( Ret == STILL_ACTIVE ); + WaitForSingleObject(pi.hProcess, INFINITE); + GetExitCodeProcess(pi.hProcess, &Ret); CloseHandle (pi.hProcess); CloseHandle (pi.hThread); ExitProcess(Ret);