-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 environment variable and/or command line option to prevent ninja from stripping color escape codes #916
Comments
Ninja doesn't strip the escapes. gcc/clang turn off the color when they're run under ninja. There's more discussion here, that I think summarizes all the pros and cons of all the workarounds. |
I totally misremembered the conclusion of that issue! Reopening. |
Yes, I did read up on that discussion as well. |
mgiuffrida
added a commit
to mgiuffrida/ninja
that referenced
this issue
Jan 27, 2017
Adds the general-purpose -o flag to address ninja-build#746, with options for verbosity (ninja-build#480) and control sequence stripping (ninja-build#581, ninja-build#672, ninja-build#916). Also provides the ability to enable both verbose and raw output as a workaround for ninja-build#1214 without changing the existing verbose behavior. -o verbose show all command lines while building -o quiet hide command lines and outputs while building -o raw never strip control sequences from output -o strip always strip control sequences from output -o color strip most control sequences from output, but retain color codes This patch does not affect Ninja's defaults of normal verbosity and smart terminal detection for escape sequence stripping. "-o color" is particularly useful for utilities like `head` and `less -R` that interpret color codes from stdin and pass this colored output to stdout. Any valid ANSI color code, of the form: `'ESC' '[' [ colors ] 'm'` where `colors` is a semicolon-delimited list of optional integers: `[ n ] [ ';' colors ]` is retained in its entirety when using "-o color" (any other CSI escape sequences besides ANSI color codes are still stripped for non-smart terminals).
mgiuffrida
added a commit
to mgiuffrida/ninja
that referenced
this issue
Jan 27, 2017
Adds the general-purpose -o flag to address ninja-build#746, with options for verbosity (ninja-build#480) and control sequence stripping (ninja-build#581, ninja-build#672, ninja-build#916). Also provides the ability to enable both verbose and raw output as a workaround for ninja-build#1214 without changing the existing verbose behavior. -o verbose show all command lines while building -o quiet hide command lines and outputs while building -o raw never strip control sequences from output -o strip always strip control sequences from output -o color strip most control sequences from output, but retain color codes This patch does not affect Ninja's defaults of normal verbosity and smart terminal detection for escape sequence stripping. "-o color" is particularly useful for utilities like `head` and `less -R` that interpret color codes from stdin and pass this colored output to stdout. Any valid ANSI color code, of the form: `'ESC' '[' [ colors ] 'm'` where `colors` is a semicolon-delimited list of optional integers: `[ n ] [ ';' colors ]` is retained in its entirety when using "-o color" (any other CSI escape sequences besides ANSI color codes are still stripped for non-smart terminals).
mgiuffrida
added a commit
to mgiuffrida/ninja
that referenced
this issue
Jan 27, 2017
Adds the general-purpose -o flag to address ninja-build#746, with options for verbosity (ninja-build#480) and control sequence stripping (ninja-build#581, ninja-build#672, ninja-build#916). Also provides the ability to enable both verbose and raw output as a workaround for ninja-build#1214 without changing the existing verbose behavior. -o verbose show all command lines while building -o quiet hide command lines and outputs while building -o raw never strip control sequences from output -o strip always strip control sequences from output -o color strip most control sequences from output, but retain color codes This patch does not affect Ninja's defaults of normal verbosity and smart terminal detection for escape sequence stripping. "-o color" is particularly useful for utilities like `head` and `less -R` that interpret color codes from stdin and pass this colored output to stdout. Any valid ANSI color code, of the form: `'ESC' '[' [ colors ] 'm'` where `colors` is a semicolon-delimited list of optional integers: `[ n ] [ ';' colors ]` is retained in its entirety when using "-o color" (any other CSI escape sequences besides ANSI color codes are still stripped for non-smart terminals).
timniederhausen
pushed a commit
to timniederhausen/ninja
that referenced
this issue
Sep 19, 2017
Adds the general-purpose -o flag to address ninja-build#746, with options for verbosity (ninja-build#480) and control sequence stripping (ninja-build#581, ninja-build#672, ninja-build#916). Also provides the ability to enable both verbose and raw output as a workaround for ninja-build#1214 without changing the existing verbose behavior. -o verbose show all command lines while building -o quiet hide command lines and outputs while building -o raw never strip control sequences from output -o strip always strip control sequences from output -o color strip most control sequences from output, but retain color codes This patch does not affect Ninja's defaults of normal verbosity and smart terminal detection for escape sequence stripping. "-o color" is particularly useful for utilities like `head` and `less -R` that interpret color codes from stdin and pass this colored output to stdout. Any valid ANSI color code, of the form: `'ESC' '[' [ colors ] 'm'` where `colors` is a semicolon-delimited list of optional integers: `[ n ] [ ';' colors ]` is retained in its entirety when using "-o color" (any other CSI escape sequences besides ANSI color codes are still stripped for non-smart terminals).
Fixed by bf7107b. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ninja strips out color escape codes from e.g. gcc/clang when it detects that it isn't connected to a terminal.
In a CMake/Ninja based project the QtCreator IDE invokes ninja and is apparently capable of interpreting color codes.
It would be nice if ninja would provide the means to disable stripping of color codes in this case as to allow them to be visualized by QtCreator.
The text was updated successfully, but these errors were encountered: