Added return value to nsExex. Logging still broke.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1250 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
rainwater 2002-10-01 16:37:08 +00:00
parent 62abf21381
commit 7075c16cb1

View file

@ -83,6 +83,7 @@ void ExecScript(BOOL log) {
DWORD dwExit = !STILL_ACTIVE; DWORD dwExit = !STILL_ACTIVE;
static char szBuf[1024]; static char szBuf[1024];
static char szBufTmp[4096]; static char szBufTmp[4096];
static char szRet[128];
szBufTmp[0]=0; szBufTmp[0]=0;
GetVersionEx(&osv); GetVersionEx(&osv);
if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) { if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) {
@ -114,6 +115,7 @@ void ExecScript(BOOL log) {
if (log) { if (log) {
lstrcat(szBufTmp,szBuf); lstrcat(szBufTmp,szBuf);
LogMessages(szBufTmp); LogMessages(szBufTmp);
*szBuf = 0;
} }
} }
else Sleep(LOOPTIMEOUT); else Sleep(LOOPTIMEOUT);
@ -122,39 +124,29 @@ void ExecScript(BOOL log) {
PeekNamedPipe(read_stdout, 0, 0, 0, &dwRead, NULL); PeekNamedPipe(read_stdout, 0, 0, 0, &dwRead, NULL);
} }
} }
wsprintf(szRet,"%d",dwExit);
pushstring(szRet);
CloseHandle(pi.hThread); CloseHandle(pi.hThread);
CloseHandle(pi.hProcess); CloseHandle(pi.hProcess);
CloseHandle(newstdout); CloseHandle(newstdout);
CloseHandle(read_stdout); CloseHandle(read_stdout);
} }
} }
int LogMessages(const char *pStr) { int LogMessages(const char *pStr) {
if (my_strstr(pStr,"\r")) { if (my_strstr(pStr,"\r\n")) {
while (*pStr) { while (*pStr) {
char *i = my_strstr(pStr,"\r"); char *i = my_strstr(pStr,"\r\n");
if (i==0) {
LogMessage(pStr);
break;
}
*i=0;
if (*(i+1)=='\n') *(i+1)=0;
LogMessage(pStr);
if (!*(i+1)) pStr = i+2;
else pStr = i+1;
}
}
else if (my_strstr(pStr,"\n")) {
while (*pStr) {
char *i = my_strstr(pStr,"\n");
if (i==0) { if (i==0) {
LogMessage(pStr); LogMessage(pStr);
break; break;
} }
else {
*i=0; *i=0;
LogMessage(pStr); LogMessage(pStr);
pStr = i+1; if (i-pStr<0) break;
pStr = i+2;
}
} }
} }
return 1; return 1;