cmd: Wait for command to complete when spawned through cmd /c.

This commit is contained in:
Jason Edmeades 2012-11-29 23:23:25 +00:00 committed by Alexandre Julliard
parent 8b98b6a532
commit 64d7151669
1 changed files with 4 additions and 2 deletions

View File

@ -1201,8 +1201,10 @@ void WCMD_run_program (WCHAR *command, BOOL called)
if (!assumeInternal && !console) errorlevel = 0;
else
{
/* Always wait when called in a batch program context */
if (assumeInternal || context || !HIWORD(console)) WaitForSingleObject (pe.hProcess, INFINITE);
/* Always wait when non-interactive (cmd /c or in batch program),
or for console applications */
if (assumeInternal || !interactive || !HIWORD(console))
WaitForSingleObject (pe.hProcess, INFINITE);
GetExitCodeProcess (pe.hProcess, &errorlevel);
if (errorlevel == STILL_ACTIVE) errorlevel = 0;
}