temp console app now returns correct exitcode from spawned process, temp file is deleted on end
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2766 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
f7f575a8cb
commit
d692d11772
2 changed files with 11 additions and 6 deletions
|
@ -123,7 +123,7 @@ void ExecScript(int log) {
|
||||||
|
|
||||||
g_to = 0; // default is no timeout
|
g_to = 0; // default is no timeout
|
||||||
g_hwndList = FindWindowEx(FindWindowEx(g_hwndParent,NULL,"#32770",NULL),NULL,"SysListView32",NULL);
|
g_hwndList = FindWindowEx(FindWindowEx(g_hwndParent,NULL,"#32770",NULL),NULL,"SysListView32",NULL);
|
||||||
pExec = g_exec + nComSpecSize - 1; *pExec = ' '; pExec++;
|
pExec = g_exec + nComSpecSize - 2; *pExec = ' '; pExec++;
|
||||||
popstring(pExec);
|
popstring(pExec);
|
||||||
if ( my_strstr(pExec, "/TIMEOUT=") ) {
|
if ( my_strstr(pExec, "/TIMEOUT=") ) {
|
||||||
char *szTimeout = pExec + 9;
|
char *szTimeout = pExec + 9;
|
||||||
|
@ -265,6 +265,8 @@ done:
|
||||||
CloseHandle(pi.hProcess);
|
CloseHandle(pi.hProcess);
|
||||||
CloseHandle(newstdout);
|
CloseHandle(newstdout);
|
||||||
CloseHandle(read_stdout);
|
CloseHandle(read_stdout);
|
||||||
|
*(pExec-1) = '\0';
|
||||||
|
DeleteFile(g_exec);
|
||||||
GlobalFree(g_exec);
|
GlobalFree(g_exec);
|
||||||
if (log) {
|
if (log) {
|
||||||
GlobalUnlock(hUnusedBuf);
|
GlobalUnlock(hUnusedBuf);
|
||||||
|
@ -359,10 +361,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||||
|
|
||||||
cmdline = command_line;
|
cmdline = command_line;
|
||||||
if (*cmdline == '\"') seekchar = *cmdline++;
|
if (*cmdline == '\"') seekchar = *cmdline++;
|
||||||
|
|
||||||
while (*cmdline && *cmdline != seekchar) cmdline=CharNext(cmdline);
|
while (*cmdline && *cmdline != seekchar) cmdline=CharNext(cmdline);
|
||||||
cmdline=CharNext(cmdline);
|
cmdline=CharNext(cmdline);
|
||||||
|
|
||||||
Ret = CreateProcess (NULL, cmdline,
|
Ret = CreateProcess (NULL, cmdline,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
TRUE, 0,
|
TRUE, 0,
|
||||||
|
@ -370,10 +372,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||||
&si, &pi
|
&si, &pi
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Ret)
|
if ( Ret )
|
||||||
{
|
{
|
||||||
WaitForSingleObject (pi.hProcess, INFINITE);
|
do
|
||||||
GetExitCodeProcess(pi.hProcess, &Ret);
|
{
|
||||||
|
GetExitCodeProcess(pi.hProcess, &Ret);
|
||||||
|
Sleep(LOOPTIMEOUT);
|
||||||
|
} while ( Ret == STILL_ACTIVE );
|
||||||
CloseHandle (pi.hProcess);
|
CloseHandle (pi.hProcess);
|
||||||
CloseHandle (pi.hThread);
|
CloseHandle (pi.hThread);
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue