Skip to content

Commit

Permalink
cmd/docker: only parse global arguments once.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ian Campbell committed Apr 3, 2019
1 parent f7a3fc5 commit 984fbba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit 984fbba

Please sign in to comment.