Skip to content

Commit

Permalink
console: Add support for the NO_COLOR environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dscharrer committed Feb 20, 2019
1 parent 80d9880 commit 7d878a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/innoextract.1.in
Expand Up @@ -116,7 +116,7 @@ With the "\fBrename\fP" action, steps 1 and 3 are only applied to files that wou
\fB\-c\fP, \fB\-\-color\fP[=\fIENABLE\fP]
By default
.B innoextract
will try to detect if the terminal supports shell escape codes and enable or disable color output accordingly. Specifically, colors will be enabled if both \fBstdout\fP and \fBstderr\fP point to a TTY and the \fBTERM\fP environment variable is not set to "\fBdumb\fP". Pass \fB1\fP or \fBtrue\fP to \fB\-\-color\fP to force color output. Pass \fB0\fP or \fBfalse\fP to never output color codes.
will try to detect if the terminal supports shell escape codes and enable or disable color output accordingly. Specifically, colors will be enabled if both \fBstdout\fP and \fBstderr\fP point to a TTY, the \fBTERM\fP environment variable is not set to "\fBdumb\fP" and the \fBNO_COLOR\fP environment is unset. Pass \fB1\fP or \fBtrue\fP to \fB\-\-color\fP to force color output. Pass \fB0\fP or \fBfalse\fP to never output color codes.
.TP
\fB\-V\FP, \fB\-\-data\-version\fP
Print the Inno Setup data version of the installer and exit immediately.
Expand Down
2 changes: 1 addition & 1 deletion src/util/console.cpp
Expand Up @@ -130,7 +130,7 @@ void init(is_enabled color, is_enabled progress) {
&dim_blue, &dim_magenta, &dim_cyan, &dim_white,
};

if(color == disable || (color == automatic && !is_tty)) {
if(color == disable || (color == automatic && (!is_tty || std::getenv("NO_COLOR") != NULL))) {

BOOST_FOREACH(shell_command * color, all_colors) {
color->command = "";
Expand Down

0 comments on commit 7d878a0

Please sign in to comment.