1
0
mirror of https://github.com/docker/cli.git synced 2026-01-18 08:21:31 +03:00

Fix a panic when the DOCKER_HOST was invalid using cobra commands.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 55d46e8352
Component: cli
This commit is contained in:
Daniel Nephin
2016-06-06 14:17:04 -04:00
parent 2f724ecf5d
commit bd7d99cb26

View File

@@ -71,7 +71,9 @@ func (c CobraAdaptor) Usage() []cli.Command {
}
func (c CobraAdaptor) run(cmd string, args []string) error {
c.dockerCli.Initialize()
if err := c.dockerCli.Initialize(); err != nil {
return err
}
// Prepend the command name to support normal cobra command delegation
c.rootCmd.SetArgs(append([]string{cmd}, args...))
return c.rootCmd.Execute()