mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Send Ctrl signals to child process correctly. We can now use CTRL+C to close programs in cmd!
svn path=/trunk/; revision=19022
This commit is contained in:
parent
e087024bb5
commit
616d5f3ade
1 changed files with 24 additions and 10 deletions
|
@ -469,11 +469,12 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
TRUE,
|
TRUE,
|
||||||
CREATE_NEW_PROCESS_GROUP,
|
0, /* CREATE_NEW_PROCESS_GROUP */
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&stui,
|
&stui,
|
||||||
&prci))
|
&prci))
|
||||||
|
|
||||||
{
|
{
|
||||||
if (IsConsoleProcess(prci.hProcess))
|
if (IsConsoleProcess(prci.hProcess))
|
||||||
{
|
{
|
||||||
|
@ -1295,12 +1296,12 @@ ProcessInput (BOOL bFlag)
|
||||||
ReadCommand (readline, CMDLINE_LENGTH);
|
ReadCommand (readline, CMDLINE_LENGTH);
|
||||||
ip = readline;
|
ip = readline;
|
||||||
bEchoThisLine = FALSE;
|
bEchoThisLine = FALSE;
|
||||||
bIsBatch = FALSE;
|
bIsBatch = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bIsBatch = TRUE;
|
bIsBatch = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* skip leading blanks */
|
/* skip leading blanks */
|
||||||
while ( _istspace(*ip) )
|
while ( _istspace(*ip) )
|
||||||
|
@ -1426,20 +1427,33 @@ ProcessInput (BOOL bFlag)
|
||||||
BOOL WINAPI BreakHandler (DWORD dwCtrlType)
|
BOOL WINAPI BreakHandler (DWORD dwCtrlType)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static BOOL SelfGenerated = FALSE;
|
||||||
|
|
||||||
if ((dwCtrlType != CTRL_C_EVENT) &&
|
if ((dwCtrlType != CTRL_C_EVENT) &&
|
||||||
(dwCtrlType != CTRL_BREAK_EVENT))
|
(dwCtrlType != CTRL_BREAK_EVENT))
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(SelfGenerated)
|
||||||
|
{
|
||||||
|
SelfGenerated = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (bChildProcessRunning == TRUE)
|
if (bChildProcessRunning == TRUE)
|
||||||
{
|
{
|
||||||
GenerateConsoleCtrlEvent (CTRL_C_EVENT,
|
SelfGenerated = TRUE;
|
||||||
dwChildProcessId);
|
GenerateConsoleCtrlEvent (dwCtrlType, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bCtrlBreak = TRUE;
|
||||||
/* FIXME: Handle batch files */
|
/* FIXME: Handle batch files */
|
||||||
|
|
||||||
/* FIXME: Print "^C" */
|
//ConOutPrintf(_T("^C"));
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue