Skip to content

Commit

Permalink
cli(color): don't use color on non-tty (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
evenstensberg authored May 20, 2018
1 parent 8c58d24 commit e87fd7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 210 deletions.
9 changes: 7 additions & 2 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ For more information, see https://webpack.js.org/api/cli/.`);
type: "boolean",
alias: "colors",
default: function supportsColor() {
return require("supports-color").supportsColor;
if (process.stdout.isTTY === true) {
return require("supports-color").supportsColor;
}
},
group: DISPLAY_GROUP,
describe: "Enables/Disables colors on the console"
Expand Down Expand Up @@ -321,7 +323,10 @@ For more information, see https://webpack.js.org/api/cli/.`);
}
});

if (typeof outputOptions.colors === "undefined")
if (
typeof outputOptions.colors === "undefined" &&
process.stdout.isTTY === true
)
outputOptions.colors = require("supports-color").stdout;

ifArg("sort-modules-by", function(value) {
Expand Down
208 changes: 0 additions & 208 deletions bin/process-options.js

This file was deleted.

0 comments on commit e87fd7d

Please sign in to comment.