From 502e50c0948bfcba173c55e8f4ee03c3264a746e Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 9 Nov 2007 18:42:03 +0000 Subject: [PATCH] WaitForSingleObject is simpler than looping on GetExitCodeProcess and allows the process to return STILL_ACTIVE git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5364 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/nsExec/nsexec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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);