Skip to content

Commit

Permalink
Merge pull request #55925 from bruvzg/win_console
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Dec 14, 2021
2 parents 6061594 + 38c1706 commit b423dc0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion platform/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2857,7 +2857,12 @@ Error OS_Windows::execute(const String &p_path, const List<String> &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) {
Expand Down

0 comments on commit b423dc0

Please sign in to comment.