[CMD] Don't reset bCtrlBreak too early.

This allows to break commands such as:

C:\ReactOS\system32> for %f in (*.*) do dir

as one would expect: stop the currently running 'dir' and the 'for'.
"bCtrlBreak" doesn't need to be volatile too.
This commit is contained in:
Hermès Bélusca-Maïto 2018-04-29 00:53:49 +02:00
parent 6dd27bd467
commit a3b36f8d3e
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 14 additions and 7 deletions

View file

@ -151,7 +151,7 @@ typedef NTSTATUS (WINAPI *NtReadVirtualMemoryProc)(HANDLE, PVOID, PVOID, ULONG,
BOOL bExit = FALSE; /* indicates EXIT was typed */
BOOL bCanExit = TRUE; /* indicates if this shell is exitable */
volatile BOOL bCtrlBreak = FALSE; /* Ctrl-Break or Ctrl-C hit */
BOOL bCtrlBreak = FALSE; /* Ctrl-Break or Ctrl-C hit */
BOOL bIgnoreEcho = FALSE; /* Set this to TRUE to prevent a newline, when executing a command */
static BOOL bWaitForCommand = FALSE; /* When we are executing something passed on the commandline after /c or /k */
INT nErrorLevel = 0; /* Errorlevel of last launched external program */
@ -1448,6 +1448,9 @@ ProcessInput(VOID)
while (!bCanExit || !bExit)
{
/* Reset the Ctrl-Break / Ctrl-C state */
bCtrlBreak = FALSE;
Cmd = ParseCommand(NULL);
if (!Cmd)
continue;
@ -1500,7 +1503,7 @@ BOOL WINAPI BreakHandler(DWORD dwCtrlType)
/* FIXME: Handle batch files */
//ConOutPrintf(_T("^C"));
// ConOutPrintf(_T("^C"));
return TRUE;
}