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

Disable all colors in Buildpacks’s output when not in a terminal #3651

Merged
merged 2 commits into from Feb 6, 2020

Conversation

dgageot
Copy link
Contributor

@dgageot 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 <david@gageot.net>
@codecov
Copy link

codecov bot commented Feb 6, 2020

Codecov Report

Merging #3651 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted Files Coverage Δ
pkg/skaffold/build/buildpacks/lifecycle.go 75% <ø> (+3.57%) ⬆️
pkg/skaffold/build/buildpacks/logger.go 0% <0%> (ø) ⬆️


l := logrus.New()
l.SetOutput(out)
l.SetFormatter(new(plainFormatter))
Copy link
Member

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

Copy link
Contributor Author

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)
Copy link
Member

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.

Copy link
Contributor Author

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 <david@gageot.net>
@balopat balopat merged commit c6bbc3e into GoogleContainerTools:master Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants