From 8c087b6a1e5ebc1170587c1b73cc3640495882a9 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 3 Apr 2019 11:53:31 +0100 Subject: [PATCH] cmd/docker: only parse global arguments once. Before calling `cmd.Execute` we need to reset the arguments to be used to not include the global arguments which we have already parsed. This is precisely the `args` which we have in our hand at this point. This fixes `TestGlobalArgsOnlyParsedOnce/builtin` in the cli-plugins e2e tests. `TestGlobalArgsOnlyParsedOnce/plugin` is still broken will be fixed next. Signed-off-by: Ian Campbell --- cmd/docker/docker.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/docker/docker.go b/cmd/docker/docker.go index 1afbea3787..450d20e72e 100644 --- a/cmd/docker/docker.go +++ b/cmd/docker/docker.go @@ -228,6 +228,9 @@ func runDocker(dockerCli *command.DockerCli) error { } } + // We've parsed global args already, so reset args to those + // which remain. + cmd.SetArgs(args) return cmd.Execute() }