From f2cd51e787372320f7407f1056201659e545c945 Mon Sep 17 00:00:00 2001 From: kichik Date: Sat, 29 Mar 2008 17:53:23 +0000 Subject: [PATCH] fixed bug #1909458 - nsEcec: cannot handle exit code 259 git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5584 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/nsExec/nsexec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Contrib/nsExec/nsexec.c b/Contrib/nsExec/nsexec.c index 74927ea5..dba3cafb 100644 --- a/Contrib/nsExec/nsexec.c +++ b/Contrib/nsExec/nsexec.c @@ -208,7 +208,8 @@ params: HANDLE newstdout=0,read_stdout=0; HANDLE newstdin=0,read_stdin=0; DWORD dwRead = 1; - DWORD dwExit = !STILL_ACTIVE; + DWORD dwExit = 0; + DWORD dwWait = WAIT_TIMEOUT; DWORD dwLastOutput; static char szBuf[1024]; HGLOBAL hUnusedBuf = NULL; @@ -254,7 +255,7 @@ params: dwLastOutput = GetTickCount(); - while (dwExit == STILL_ACTIVE || dwRead) { + while (dwWait != WAIT_OBJECT_0 || dwRead) { PeekNamedPipe(read_stdout, 0, 0, 0, &dwRead, NULL); if (dwRead) { dwLastOutput = GetTickCount(); @@ -331,10 +332,10 @@ params: } else Sleep(LOOPTIMEOUT); } + + dwWait = WaitForSingleObject(pi.hProcess, 0); GetExitCodeProcess(pi.hProcess, &dwExit); - if (dwExit != STILL_ACTIVE) { - PeekNamedPipe(read_stdout, 0, 0, 0, &dwRead, NULL); - } + PeekNamedPipe(read_stdout, 0, 0, 0, &dwRead, NULL); } done: if (log & 2) pushstring(szUnusedBuf);