-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Add --color
command line argument to control colored console output
#77261
Open
Calinou
wants to merge
1
commit into
godotengine:master
Choose a base branch
from
Calinou:cli-color-add-options
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+107
−66
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This also adds support for the `NO_COLOR` environment variable, and harmonizes checks for colored console output by using a unique Engine method. - `auto` (default): Only color if output is a TTY (interactive session). Color is disabled if the `NO_COLOR` environment variable is set to a non-empty string, as per <https://no-color.org>. - `always`: Always color, even if output is a file or is non-interactive (useful for continuous integration, which is non-interactive). This also bypasses `NO_COLOR` as per its specification. - `never`: Never color command line output.
Calinou
force-pushed
the
cli-color-add-options
branch
from
July 17, 2023 07:25
dfafc67
to
4dd89b4
Compare
I've tried to fix the build on Windows, but am not sure how to fix the heap-use-after-free in the Linux build: ==7218==ERROR: AddressSanitizer: heap-use-after-free on address 0x612000009650 at pc 0x5577491682f7 bp 0x7fff032db4d0 sp 0x7fff032db4c0
READ of size 8 at 0x612000009650 thread T0
#0 0x5577491682f6 in UnixTerminalLogger::log_error(char const*, char const*, int, char const*, char const*, bool, Logger::ErrorType) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x45dfb2f6)
#1 0x55775ada11f3 in CompositeLogger::log_error(char const*, char const*, int, char const*, char const*, bool, Logger::ErrorType) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x57a341f3)
#2 0x55775a71fe05 in OS::print_error(char const*, char const*, int, char const*, char const*, bool, Logger::ErrorType) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x573b2e05)
#3 0x55775c1f4cf9 in _err_print_error(char const*, char const*, int, char const*, char const*, bool, ErrorHandlerType) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x58e87cf9)
#4 0x55775c1f49ab in _err_print_error(char const*, char const*, int, char const*, bool, ErrorHandlerType) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x58e879ab)
#5 0x55775bf1c1ca in ObjectDB::cleanup() (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x58baf1ca)
#6 0x55775a5520bd in unregister_core_types() (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x571e50bd)
#7 0x55773fd09e89 in Main::test_cleanup() (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c99ce89)
#8 0x55773fd0a29d in Main::test_entrypoint(int, char**, bool&) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c99d29d)
#9 0x55773fa8be31 in main (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c71ee31)
#10 0x7f861c5b0082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
#11 0x55773fa8bbad in _start (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c71ebad)
0x612000009650 is located 16 bytes inside of 264-byte region [0x612000009640,0x612000009748)
freed by thread T0 here:
#0 0x7f861d37040f in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:122
#1 0x55775a71a7c8 in Memory::free_static(void*, bool) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x573ad7c8)
#2 0x55773fd8c5c4 in void memdelete<Engine>(Engine*) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3ca1f5c4)
#3 0x55773fd09e70 in Main::test_cleanup() (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c99ce70)
#4 0x55773fd0a29d in Main::test_entrypoint(int, char**, bool&) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c99d29d)
#5 0x55773fa8be31 in main (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c71ee31)
#6 0x7f861c5b0082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
previously allocated by thread T0 here:
#0 0x7f861d370808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
#1 0x55775a71976d in Memory::alloc_static(unsigned long, bool) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x573ac76d)
#2 0x55775a71967e in operator new(unsigned long, char const*) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x573ac67e)
#3 0x55773fd079a1 in Main::test_setup() (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c99a9a1)
#4 0x55773fd0a284 in Main::test_entrypoint(int, char**, bool&) (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c99d284)
#5 0x55773fa8be31 in main (/home/runner/work/godot/godot/bin/godot.linuxbsd.editor.dev.double.x86_64.san+0x3c71ee31)
#6 0x7f861c5b0082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) The problematic line is https://github.com/Calinou/godot/blob/4dd89b440234c8e1b4d7e6da748d20d859049f0f/drivers/unix/os_unix.cpp#L794. I'm just not sure how to avoid having to query the Engine singleton here, while keeping the solution as local as possible. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This also adds support for the
NO_COLOR
environment variable, and harmonizes checks for colored console output by using a unique Engine method.auto
(default): Only color if output is a TTY (interactive session). Color is disabled if theNO_COLOR
environment variable is set to a non-empty string, as per https://no-color.org.always
: Always color, even if output is a file or is non-interactive (useful for continuous integration, which is non-interactive). This also bypassesNO_COLOR
as per its specification.never
: Never color command line output.Preview