From 38c1706a7d4df5fe1ba5073e3357c0da4f466ed8 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 14 Dec 2021 14:38:42 +0200 Subject: [PATCH] [Windows] Open a new console window for the editor instances. --- platform/windows/os_windows.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 2aab5f4078d9..dcf23b61abb8 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2857,7 +2857,12 @@ Error OS_Windows::execute(const String &p_path, const List &p_arguments, modstr.write[i] = cmdline[i]; } - int ret = CreateProcessW(NULL, modstr.ptrw(), NULL, NULL, 0, NORMAL_PRIORITY_CLASS & CREATE_NO_WINDOW, NULL, NULL, si_w, &pi.pi); + DWORD creation_flags = NORMAL_PRIORITY_CLASS & CREATE_NO_WINDOW; + if (p_path == get_executable_path() && GetConsoleWindow() != NULL) { + creation_flags |= CREATE_NEW_CONSOLE; + } + + int ret = CreateProcessW(NULL, modstr.ptrw(), NULL, NULL, 0, creation_flags, NULL, NULL, si_w, &pi.pi); ERR_FAIL_COND_V(ret == 0, ERR_CANT_FORK); if (p_blocking) {