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

Better detection of terminals. #3611

Merged
merged 2 commits into from Jan 30, 2020

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Jan 30, 2020

Will disable docker progress bars and buildpack’s coloured output in VSCode.

cc @jonjohnsonjr

Signed-off-by: David Gageot david@gageot.net

Will disable docker progress bars and buildpack’s
coloured output in VSCode.

Signed-off-by: David Gageot <david@gageot.net>
@codecov
Copy link

codecov bot commented Jan 30, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@fad917c). Click here to learn what that means.
The diff coverage is 68.75%.

Impacted Files Coverage Δ
pkg/skaffold/build/buildpacks/lifecycle.go 66.66% <0%> (ø)
pkg/skaffold/docker/image.go 75.67% <100%> (ø)
pkg/skaffold/color/formatter.go 100% <100%> (ø)
pkg/skaffold/util/term.go 100% <100%> (ø)

io.Writer
}

// If out is not a terminal, let's make sure pack doesn't output with colors
Copy link
Member

Choose a reason for hiding this comment

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

Huh, I've never seen coloured output from pack!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol

@@ -103,12 +102,8 @@ func isTerminal(w io.Writer) bool {
return true
Copy link
Member

Choose a reason for hiding this comment

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

Is the function comment still current? Or could we just replace isTerminal with a direct call to IsTerminal()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm removing the comment. The test on ColoredWriteCloser is needed here

"strings"

"golang.org/x/crypto/ssh/terminal"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
Copy link
Member

Choose a reason for hiding this comment

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

Would it be worth rewritting this code to use heroku/color at some point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's somewhere on my TODO...


// If out is not a terminal, let's make sure pack doesn't output with colors
if _, isTerm := util.IsTerminal(out); !isTerm {
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.

I'm guessing that pack uses heroku/color under the hood? Would be worth a comment here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Signed-off-by: David Gageot <david@gageot.net>
@balopat balopat merged commit ca599fa into GoogleContainerTools:master Jan 30, 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