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
A commandline tool (which calls a shell script, which itself calls another Godot commandline script).
Describe the problem or limitation you are having in your project
Godot prints warnings and errors with useful colors to stderr, so they pop out and are easily readable in terminals/logs. When you pipe a Godot script with OS.execute_with_pipe, however, colors are stripped from stderr, as evidenced in os_unix.cpp. This means the output cannot have its original colors, which makes reading errors in the terminal (or CI logs) cumbersome.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add an option to always include colors, such as godot --color or any appropriate keyword, or godot --color=always like you would find in other commands such as ls.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Here's a comparison without and with colors, all the text visible here is printed with stdio.printraw and stderr.printraw, which are obtained from OS.execute_with_pipe.
Before (note a single colored line, which was obtained with print_rich):
After:
This result was obtained by simply removing the TTY check in os_unix.cpp, but this should instead depend on the proposed --color option passed to Godot. The shell script would therefore include a line such as:
godot --headless --color -s ./my_script.gd
If this enhancement will not be used often, can it be worked around with a few lines of script?
I think the only workaround would be to regex stderr to find and color the text.
Is there a reason why this should be core and not an add-on in the asset library?
This is about exposing an already existing core feature to piped stderr, I don't think an addon would make much sense for this.
The text was updated successfully, but these errors were encountered:
Describe the project you are working on
A commandline tool (which calls a shell script, which itself calls another Godot commandline script).
Describe the problem or limitation you are having in your project
Godot prints warnings and errors with useful colors to stderr, so they pop out and are easily readable in terminals/logs. When you pipe a Godot script with
OS.execute_with_pipe
, however, colors are stripped from stderr, as evidenced in os_unix.cpp. This means the output cannot have its original colors, which makes reading errors in the terminal (or CI logs) cumbersome.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add an option to always include colors, such as
godot --color
or any appropriate keyword, orgodot --color=always
like you would find in other commands such asls
.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Here's a comparison without and with colors, all the text visible here is printed with


stdio.printraw
andstderr.printraw
, which are obtained fromOS.execute_with_pipe
.Before (note a single colored line, which was obtained with
print_rich
):After:
This result was obtained by simply removing the TTY check in
os_unix.cpp
, but this should instead depend on the proposed--color
option passed to Godot. The shell script would therefore include a line such as:If this enhancement will not be used often, can it be worked around with a few lines of script?
I think the only workaround would be to regex stderr to find and color the text.
Is there a reason why this should be core and not an add-on in the asset library?
This is about exposing an already existing core feature to piped stderr, I don't think an addon would make much sense for this.
The text was updated successfully, but these errors were encountered: