mirror of https://github.com/docker/docs.git
Ensure log writes only to os.Stderr for env and config command
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit is contained in:
parent
43543d1579
commit
17f0a32b79
|
@ -3,6 +3,7 @@ package commands
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/machine/cli"
|
"github.com/docker/machine/cli"
|
||||||
|
@ -14,6 +15,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func cmdConfig(c *cli.Context) {
|
func cmdConfig(c *cli.Context) {
|
||||||
|
// Ensure that log messages always go to stderr when this command is
|
||||||
|
// being run (it is intended to be run in a subshell)
|
||||||
|
log.SetOutWriter(os.Stderr)
|
||||||
|
|
||||||
if len(c.Args()) != 1 {
|
if len(c.Args()) != 1 {
|
||||||
fatal(ErrExpectedOneMachine)
|
fatal(ErrExpectedOneMachine)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/docker/machine/cli"
|
"github.com/docker/machine/cli"
|
||||||
|
"github.com/docker/machine/libmachine/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -32,6 +33,10 @@ type ShellConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func cmdEnv(c *cli.Context) {
|
func cmdEnv(c *cli.Context) {
|
||||||
|
// Ensure that log messages always go to stderr when this command is
|
||||||
|
// being run (it is intended to be run in a subshell)
|
||||||
|
log.SetOutWriter(os.Stderr)
|
||||||
|
|
||||||
if len(c.Args()) != 1 && !c.Bool("unset") {
|
if len(c.Args()) != 1 && !c.Bool("unset") {
|
||||||
fatal(improperEnvArgsError)
|
fatal(improperEnvArgsError)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue