cmd: Backup echo mode before running external batch file

Frédéric Delanoy frederic.delanoy at gmail.com
Thu Sep 8 18:48:04 CDT 2011


When executing a batch file directly, i.e. by issuing "batchFile" instead of
"cmd /c batchFile.cmd", the echo mode changed in batchFile wasn't restored to
its original value upon termination.
---
 programs/cmd/wcmdmain.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 117565b..108d411 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -1228,7 +1228,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
                    CMD_LIST **cmdList)
 {
     WCHAR *cmd, *p, *redir;
-    int status, i;
+    int status, i, prev_echo_mode;
     DWORD count, creationDisposition;
     HANDLE h;
     WCHAR *whichcmd;
@@ -1581,7 +1581,9 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
         WCMD_exit (cmdList);
         break;
       default:
+        prev_echo_mode = echo_mode;
         WCMD_run_program (whichcmd, 0);
+        echo_mode = prev_echo_mode;
     }
     HeapFree( GetProcessHeap(), 0, cmd );
     HeapFree( GetProcessHeap(), 0, new_redir );
@@ -1594,6 +1596,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
       }
     }
 }
+
 /*************************************************************************
  * WCMD_LoadMessage
  *    Load a string from the resource file, handling any error
-- 
1.7.6




More information about the wine-patches mailing list