From aee35785205a0239ba071d18ea6e971961bb494c Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 31 May 2016 22:19:13 -0700 Subject: [PATCH] Convert 'docker create' to use cobra and pflag Return the correct status code on flag parsins errors. Signed-off-by: Daniel Nephin --- docker.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker.go b/docker.go index 45de2e3fca..0c727e32c9 100644 --- a/docker.go +++ b/docker.go @@ -73,6 +73,10 @@ func main() { if sterr, ok := err.(cli.StatusError); ok { if sterr.Status != "" { fmt.Fprintln(stderr, sterr.Status) + } + // StatusError should only be used for errors, and all errors should + // have a non-zero exit status, so never exit with 0 + if sterr.StatusCode == 0 { os.Exit(1) } os.Exit(sterr.StatusCode)