[PATCH] [bug9037] cmd.exe should wait when launching GUI pgms in
batch
Jason Edmeades
jason.edmeades at googlemail.com
Thu Aug 9 17:56:15 CDT 2007
If a batch program contains 2 lines such as:
notepad.exe
echo hello
When run, the echo is not run until notepad ends. However, if notepad.exe
is typed directly then the command line gets control back immediately.
This patch forces cmd to wait for program completion if in a batch context.
---
programs/cmd/wcmdmain.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 708686c..775a553 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -1090,7 +1090,8 @@ void WCMD_run_program (WCHAR *command, int called) {
if (!assumeInternal && !console) errorlevel = 0;
else
{
- if (assumeInternal || !HIWORD(console)) WaitForSingleObject (pe.hProcess, INFINITE);
+ /* Always wait when called in a batch program context */
+ if (assumeInternal || context || !HIWORD(console)) WaitForSingleObject (pe.hProcess, INFINITE);
GetExitCodeProcess (pe.hProcess, &errorlevel);
if (errorlevel == STILL_ACTIVE) errorlevel = 0;
}
--
1.5.0
More information about the wine-patches
mailing list