-
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
Disable all colors in Buildpacks’s output when not in a terminal #3651
Conversation
dgageot
commented
Feb 6, 2020
- Make sure the output from pack and from buildpacks goes to stdout
- Make sure all colors are disabled when not printing to a terminal
Signed-off-by: David Gageot <[email protected]>
Codecov Report
|
|
||
l := logrus.New() | ||
l.SetOutput(out) | ||
l.SetFormatter(new(plainFormatter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd appreciate a comment here as to why this formatter is required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
// If out is not a terminal, let's make sure pack doesn't output with colors. | ||
if _, isTerm := util.IsTerminal(out); !isTerm { | ||
// pack uses heroku/color under the hood. | ||
color.Disable(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I guess a problem here is that we never re-enable color.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the new code is more robust
Signed-off-by: David Gageot <[email protected]>