]> git.ipfire.org Git - thirdparty/curl.git/commit
tool_doswin: Restore original console settings on CTRL signal
authorJay Satiro <raysatiro@yahoo.com>
Thu, 19 Nov 2020 21:49:24 +0000 (16:49 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Tue, 12 Jan 2021 08:44:48 +0000 (03:44 -0500)
commit3831043eff9ed412428150537374facb609e5b33
treeac7dc2f8ae313fa7afcb864adf102beb50e4772b
parent33993d45fe229b1798a94de85c3642a4b001c4de
tool_doswin: Restore original console settings on CTRL signal

- Move Windows terminal init code from tool_main to tool_doswin.

- Restore the original console settings on CTRL+C and CTRL+BREAK.

Background: On Windows the curl tool changes the console settings to
enable virtual terminal processing (eg color output) if supported
(ie Win 10). The original settings are restored on exit but prior to
this change were not restored in the case of the CTRL signals.

Windows VT behavior varies depending on console/powershell/terminal;
refer to the discussion in #6226.

Assisted-by: Rich Turner
Closes https://github.com/curl/curl/pull/6226
src/tool_doswin.c
src/tool_main.c