diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-12-16 23:05:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 23:05:24 +0100 |
commit | 33e03386b37c9c854b6f5108bfd3241a1055c2e1 (patch) | |
tree | 99643d318bb9ee65c0bb2cfdc628a6e08a85851b /platform/windows/os_windows.cpp | |
parent | 350013f5f2413a9f8cbedd635a26001a1255d902 (diff) | |
parent | 1fdb6a99c8f1ac14db94c6a24bc82b0eb57b1a8a (diff) | |
download | redot-engine-33e03386b37c9c854b6f5108bfd3241a1055c2e1.tar.gz |
Merge pull request #55966 from bruvzg/wt💩4
Diffstat (limited to 'platform/windows/os_windows.cpp')
-rw-r--r-- | platform/windows/os_windows.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index d7d78ff5dc..bb6a077a5d 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -467,6 +467,16 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments, return OK; }; +bool OS_Windows::_is_win11_terminal() const { + HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD dwMode = 0; + if (GetConsoleMode(hStdOut, &dwMode)) { + return ((dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) == ENABLE_VIRTUAL_TERMINAL_PROCESSING); + } else { + return false; + } +} + Error OS_Windows::create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id) { String path = p_path.replace("/", "\\"); String command = _quote_command_line_argument(path); @@ -484,7 +494,8 @@ Error OS_Windows::create_process(const String &p_path, const List<String> &p_arg #ifndef DEBUG_ENABLED dwCreationFlags |= CREATE_NO_WINDOW; #endif - if (p_path == get_executable_path() && GetConsoleWindow() != nullptr) { + if (p_path == get_executable_path() && GetConsoleWindow() != nullptr && _is_win11_terminal()) { + // Open a new terminal as a workaround for Windows Terminal bug. dwCreationFlags |= CREATE_NEW_CONSOLE; } |