Move colorable statements to fix Windows support. (#4287)

This puts it in the main command level.

Fixes #4070
This commit is contained in:
Jeff Mitchell
2018-04-05 13:28:02 -04:00
committed by GitHub
parent 059493b587
commit f361b57fa4
2 changed files with 4 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ import (
"text/tabwriter"
"github.com/hashicorp/vault/command/token"
colorable "github.com/mattn/go-colorable"
"github.com/mitchellh/cli"
"golang.org/x/crypto/ssh/terminal"
)
@@ -99,10 +100,10 @@ func RunCustom(args []string, runOpts *RunOptions) int {
runOpts = &RunOptions{}
}
if runOpts.Stdout == nil {
runOpts.Stdout = os.Stdout
runOpts.Stdout = colorable.NewColorable(os.Stdout)
}
if runOpts.Stderr == nil {
runOpts.Stderr = os.Stderr
runOpts.Stderr = colorable.NewColorable(os.Stderr)
}
args = setupEnv(args)

View File

@@ -20,7 +20,6 @@ import (
"sync"
"time"
colorable "github.com/mattn/go-colorable"
"github.com/mitchellh/cli"
testing "github.com/mitchellh/go-testing-interface"
"github.com/posener/complete"
@@ -285,7 +284,7 @@ func (c *ServerCommand) Run(args []string) int {
// Create a logger. We wrap it in a gated writer so that it doesn't
// start logging too early.
c.logGate = &gatedwriter.Writer{Writer: colorable.NewColorable(os.Stderr)}
c.logGate = &gatedwriter.Writer{Writer: os.Stderr}
var level log.Level
c.flagLogLevel = strings.ToLower(strings.TrimSpace(c.flagLogLevel))
switch c.flagLogLevel {