Skip to content

Commit

Permalink
Merge pull request #3057 from hashicorp/f-tty
Browse files Browse the repository at this point in the history
Detect STDOUT isn't a TTY and disable color
  • Loading branch information
dadgar committed Aug 23, 2017
2 parents 815cd92 + 717bf7f commit 2c44799
Show file tree
Hide file tree
Showing 20 changed files with 1,442 additions and 133 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ IMPROVEMENTS:
rolling update could remove an unnecessary amount of allocations [GH-3070]
* api: Redact Vault.Token from AgentSelf response [GH-2988]
* cli: node-status displays node version [GH-3002]
* cli: Disable color output when STDOUT is not a TTY [GH-3057]
* client: Unmount task directories when alloc is terminal [GH-3006]
* client/template: Allow template to set Vault grace [GH-2947]
* client/template: Template emits events explaining why it is blocked [GH-3001]
Expand Down
3 changes: 2 additions & 1 deletion command/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/hashicorp/nomad/api"
"github.com/mitchellh/cli"
"github.com/mitchellh/colorstring"
"golang.org/x/crypto/ssh/terminal"
)

const (
Expand Down Expand Up @@ -126,7 +127,7 @@ func (m *Meta) Client() (*api.Client, error) {
func (m *Meta) Colorize() *colorstring.Colorize {
return &colorstring.Colorize{
Colors: colorstring.DefaultColors,
Disable: m.noColor,
Disable: m.noColor || !terminal.IsTerminal(int(os.Stdout.Fd())),
Reset: true,
}
}
Expand Down
9 changes: 0 additions & 9 deletions vendor/github.com/mattn/go-isatty/LICENSE

This file was deleted.

37 changes: 0 additions & 37 deletions vendor/github.com/mattn/go-isatty/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions vendor/github.com/mattn/go-isatty/doc.go

This file was deleted.

9 changes: 0 additions & 9 deletions vendor/github.com/mattn/go-isatty/isatty_appengine.go

This file was deleted.

18 changes: 0 additions & 18 deletions vendor/github.com/mattn/go-isatty/isatty_bsd.go

This file was deleted.

18 changes: 0 additions & 18 deletions vendor/github.com/mattn/go-isatty/isatty_linux.go

This file was deleted.

16 changes: 0 additions & 16 deletions vendor/github.com/mattn/go-isatty/isatty_solaris.go

This file was deleted.

19 changes: 0 additions & 19 deletions vendor/github.com/mattn/go-isatty/isatty_windows.go

This file was deleted.

27 changes: 27 additions & 0 deletions vendor/golang.org/x/crypto/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions vendor/golang.org/x/crypto/PATENTS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2c44799

Please sign in to comment.