mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 03:03:38 +00:00
cmd: Better handle ctrl-c events.
cmd shouldn't terminate itself when user hits ctrl-c. cmd should terminate the currently running CUI child it waits for upon ctrl-c. Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
b228e3df60
commit
91cce00dba
|
@ -2411,6 +2411,12 @@ void WCMD_free_commands(CMD_LIST *cmds) {
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL WINAPI my_event_handler(DWORD ctrl)
|
||||
{
|
||||
WCMD_output(L"\n");
|
||||
return ctrl == CTRL_C_EVENT;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Main entry point. This is a console application so we have a main() not a
|
||||
|
@ -2658,6 +2664,10 @@ int __cdecl wmain (int argc, WCHAR *argvW[])
|
|||
if (opt_s && *cmd=='\"')
|
||||
WCMD_strip_quotes(cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetConsoleCtrlHandler(my_event_handler, TRUE);
|
||||
}
|
||||
|
||||
/* Save cwd into appropriate env var (Must be before the /c processing */
|
||||
GetCurrentDirectoryW(ARRAY_SIZE(string), string);
|
||||
|
|
Loading…
Reference in a new issue