Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows, 4.0] Improve console handling and execute/create_process. #56012

Merged
merged 1 commit into from
Jan 17, 2022

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Dec 17, 2021

Same as #55987 for 4.0.

With these changes, console behavior on Windows should be the same as on Linux and macOS:

  • When editor is started from the console (or by another process with active console), output will be redirected to the parent console (including output from the running projects).
  • When editor is started from the GUI (shortcut, Windows Explorer, etc.), no console is opened.

Changes:

  • Always build with the GUI subsystem.
  • Redirect stdout and stderr output to the parent process console.
  • Use CreateProcessW for blocking execute calls with piped stdout and stderr (prevent console windows for popping up when used with the GUI subsystem build, and have more consistent behavior with create_process).
  • Add open_console argument to the execute and create_process to open a new console window.
  • Remove interface/editor/hide_console_window editor setting.
  • Remove Toggle System Console menu option.
  • Remove set_console_visible and is_console_visible functions.

Supersede: #53884
Fixes #31623 (showing console window is controlled by extra argument), "fixes" #26429 (cmd /c is always required for the built-in commands).

@bruvzg
Copy link
Member Author

bruvzg commented Dec 17, 2021

Old behavior can be easily achieved with the following methods:

Use a batch file, like this:

@echo off
godot.windows.opt.tools.64.exe
pause > nul

Or add cmd /k to the target in the shortcut:
Screenshot 2021-12-17 111505

Always build with the GUI subsystem.
Redirect stdout and stderr output to the parent process console.
Use CreateProcessW for blocking `execute` calls with piped stdout and stderr (prevent console windows for popping up when used with the GUI subsystem build, and have more consistent behavior with `create_process`).
Add `open_console` argument to the `execute` and `create_process` to open a new console window.
Remove `interface/editor/hide_console_window` editor setting.
Remove `Toggle System Console` menu option.
Remove `set_console_visible` and `is_console_visible` functions.
@akien-mga akien-mga merged commit 8bdef23 into godotengine:master Jan 17, 2022
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OS.execute() on Windows shows a command window, but only when run from a release export template
2 participants