From 55d46e8352713ef50a2f888fc642c8855bcc3362 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 6 Jun 2016 14:17:04 -0400 Subject: [PATCH] Fix a panic when the DOCKER_HOST was invalid using cobra commands. Signed-off-by: Daniel Nephin --- cobraadaptor/adaptor.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cobraadaptor/adaptor.go b/cobraadaptor/adaptor.go index ca7d4e54c0..342c1f8781 100644 --- a/cobraadaptor/adaptor.go +++ b/cobraadaptor/adaptor.go @@ -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()