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

Game process STDOUT is not captured and printed properly on Godot console #78114

Open
rohanrhu opened this issue Jun 11, 2023 · 5 comments
Open

Comments

@rohanrhu
Copy link
Contributor

Godot version

v4.0.3.stable.mono.official [5222a99]

System information

macOS 13.4 Ventura

Issue description

Hi,

When Godot 4 editor spawns the game process, the STDOUT of it is not captured and printed on editor console by Godot process.

We need this feature because we don't even have debugging support for threads and at least we could see error messages if we had this feature.

Steps to reproduce

This is a very important need when you do multi-threading...

For example:

  • Have an errored thing in your thread
  • Run your game
  • You will not see any error message from your thread and debugger will not interrupt on an error inside the thread and you are not able to use breakpoints too for threads

Minimal reproduction project

Meow

@AThousandShips
Copy link
Member

AThousandShips commented Jun 11, 2023

STDOUT from where? From raw C++ calls?

@rohanrhu
Copy link
Contributor Author

STDOUT from where? From raw C++ calls?

Each process has a STDOUT, normally when Godot editors fork a new process, it has its own STDOUT, so it must be captured by the Godot editor process and print on editor console.

Things that are printed with GDScript's print() are captured by Godot's debug prtocol; because game process is connecting to debug server of the editor. But we must optionally on/off seeing STDOUT of game process too on the editor.

@KoBeWi
Copy link
Member

KoBeWi commented Jun 11, 2023

Sounds like something that was fixed by #77080
Try in 4.1 beta

@StagnationPoint
Copy link
Contributor

StagnationPoint commented May 11, 2024

This is not fixed in 4.2.2. A simple test in a C#-enabled project is to put the following code somewhere it'll get hit:

System.Console.Out.WriteLine("foo");

I run the game in the editor, I do not see foo. Run it from the command line by invoking the editor with the --path argument supplied, and I do see it in the output.

Note that STDERR does not appear to be captured either. Ideally both would come through in the editor.

@toolness
Copy link

I found this confusing too, though I found the following workarounds.

  • On Windows, use the version of the Godot executable that has _console in its name.

  • On MacOS, launch Godot from the Terminal by running /Applications/Godot.app/Contents/MacOS/Godot (or create a symlink to it and run that).

This will log both Godot output and your thread's stdout/stderr to the console. It's not as ideal as seeing everything in the editor's actual console, but it's much better than nothing!

Note also that you may want to use the -e flag to ensure that your project is loaded in the editor, rather than just running the game itself, e.g. on Windows this might be:

cd <your project dir>
godot_console -e .

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

No branches or pull requests

6 participants