Skip to content
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

cli(color): don't use supports-color on non-tty #452

Merged
merged 1 commit into from
May 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR says to not use supports-color. So why here it's the opposite?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use supports-color on non-tty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I see my mistake :D

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.