diff --git a/command/commands.go b/command/commands.go index 37291f8b3..ab2173904 100644 --- a/command/commands.go +++ b/command/commands.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/nomad/command/agent" "github.com/hashicorp/nomad/drivers/docker/docklog" "github.com/hashicorp/nomad/version" + colorable "github.com/mattn/go-colorable" "github.com/mitchellh/cli" ) @@ -63,8 +64,8 @@ func Commands(metaPtr *Meta, agentUi cli.Ui) map[string]cli.CommandFactory { if meta.Ui == nil { meta.Ui = &cli.BasicUi{ Reader: os.Stdin, - Writer: os.Stdout, - ErrorWriter: os.Stderr, + Writer: colorable.NewColorableStdout(), + ErrorWriter: colorable.NewColorableStderr(), } } diff --git a/main.go b/main.go index 5f7169670..9637c7742 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/nomad/command" "github.com/hashicorp/nomad/drivers/docker/docklog" "github.com/hashicorp/nomad/version" + "github.com/mattn/go-colorable" "github.com/mitchellh/cli" "github.com/sean-/seed" "golang.org/x/crypto/ssh/terminal" @@ -91,8 +92,8 @@ func RunCustom(args []string) int { isTerminal := terminal.IsTerminal(int(os.Stdout.Fd())) metaPtr.Ui = &cli.BasicUi{ Reader: os.Stdin, - Writer: os.Stdout, - ErrorWriter: os.Stderr, + Writer: colorable.NewColorableStdout(), + ErrorWriter: colorable.NewColorableStderr(), } // The Nomad agent never outputs color