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 <ijc@docker.com>
This commit is contained in:
Ian Campbell 2019-04-03 11:53:31 +01:00
parent d32f3647b1
commit 8c087b6a1e
1 changed files with 3 additions and 0 deletions

View File

@ -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()
}