Open rohanrhu opened 1 year ago
STDOUT from where? From raw C++ calls?
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.
Sounds like something that was fixed by #77080 Try in 4.1 beta
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.
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 .
Godot version
v4.0.3.stable.mono.official [5222a99f5]
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:
Minimal reproduction project
Meow