You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to use OS.read_string_from_stdin() if the application is not launched from the console wrapper produced with debug enabled it switches between giving input back to the running console and the game. This is likely a Windows specific issue but I don't have other platforms to test on at the moment.
It doesn't matter if the game is headless or not. It also doesn't matter if OS.read_string_from_stdin() is in a separate thread.
Steps to reproduce
-Make an empty scene, set it as main.
-Attach a script that calls OS.read_string_from_stdin() at least more than once.
-Build game.
-Run game directly from console (not the console wrapper)
-Try to enter input a few times.
Minimal reproduction project (MRP)
(How to see the error.)
-Open project.
-Build project with "Export With Debug" checked.
-Run the project from the console with: "Read Console Error.exe"
-Enter the command 'hi' a few times to see the context switch back and forth
Run the project from the console with "Read Console Error.console.exe" to see that the console wrapper makes the issue go away.
This is one of the reason console wrapper exist, if you are running an app without it, you should not expect any console IO to work at all. If you want a single executable with console support, use a custom build with windows_subsystem=console flag.
That makes sense, perhaps this info and/or an example of using the windows_subsytem=console flag could be added to the docs of OS.read_string_from_stdin() for those like me trying to make a stand alone headless server on Windows? Without coming here and reading this issue I would have no idea what else I could do besides using the debug console wrapper.
At the very least it would be nice to see this issue noted somewhere as I almost missed it and it took me a while to figure out why it wasn't happening when I first started using OS.read_string_from_stdin().
Tested versions
Reproducible in: v4.2.1.stable.official [b09f793]
System information
Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.3742) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)
Issue description
When trying to use OS.read_string_from_stdin() if the application is not launched from the console wrapper produced with debug enabled it switches between giving input back to the running console and the game. This is likely a Windows specific issue but I don't have other platforms to test on at the moment.
It doesn't matter if the game is headless or not. It also doesn't matter if OS.read_string_from_stdin() is in a separate thread.
Steps to reproduce
-Make an empty scene, set it as main.
-Attach a script that calls OS.read_string_from_stdin() at least more than once.
-Build game.
-Run game directly from console (not the console wrapper)
-Try to enter input a few times.
Minimal reproduction project (MRP)
(How to see the error.)
-Open project.
-Build project with "Export With Debug" checked.
-Run the project from the console with: "Read Console Error.exe"
-Enter the command 'hi' a few times to see the context switch back and forth
Run the project from the console with "Read Console Error.console.exe" to see that the console wrapper makes the issue go away.
Read_Console_Error.zip
The text was updated successfully, but these errors were encountered: