1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #28231 from yuexiao-wang/container-exec

Remove redundant parameter and fix typos
This commit is contained in:
Lei Jitang 2016-11-11 09:55:42 +08:00 committed by GitHub
commit 891e03eb7d
4 changed files with 7 additions and 9 deletions

View file

@ -65,7 +65,7 @@ func NewExecCommand(dockerCli *command.DockerCli) *cobra.Command {
} }
func runExec(dockerCli *command.DockerCli, opts *execOptions, container string, execCmd []string) error { func runExec(dockerCli *command.DockerCli, opts *execOptions, container string, execCmd []string) error {
execConfig, err := parseExec(opts, container, execCmd) execConfig, err := parseExec(opts, execCmd)
// just in case the ParseExec does not exit // just in case the ParseExec does not exit
if container == "" || err != nil { if container == "" || err != nil {
return cli.StatusError{StatusCode: 1} return cli.StatusError{StatusCode: 1}
@ -181,14 +181,13 @@ func getExecExitCode(ctx context.Context, client apiclient.ContainerAPIClient, e
// parseExec parses the specified args for the specified command and generates // parseExec parses the specified args for the specified command and generates
// an ExecConfig from it. // an ExecConfig from it.
func parseExec(opts *execOptions, container string, execCmd []string) (*types.ExecConfig, error) { func parseExec(opts *execOptions, execCmd []string) (*types.ExecConfig, error) {
execConfig := &types.ExecConfig{ execConfig := &types.ExecConfig{
User: opts.user, User: opts.user,
Privileged: opts.privileged, Privileged: opts.privileged,
Tty: opts.tty, Tty: opts.tty,
Cmd: execCmd, Cmd: execCmd,
Detach: opts.detach, Detach: opts.detach,
// container is not used here
} }
// If -d is not set, attach to everything by default // If -d is not set, attach to everything by default

View file

@ -8,7 +8,6 @@ import (
type arguments struct { type arguments struct {
options execOptions options execOptions
container string
execCmd []string execCmd []string
} }
@ -73,7 +72,7 @@ func TestParseExec(t *testing.T) {
} }
for valid, expectedExecConfig := range valids { for valid, expectedExecConfig := range valids {
execConfig, err := parseExec(&valid.options, valid.container, valid.execCmd) execConfig, err := parseExec(&valid.options, valid.execCmd)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View file

@ -24,7 +24,7 @@ Options:
--help Print usage --help Print usage
``` ```
List the changed files and directories in a container᾿s filesystem List the changed files and directories in a container᾿s filesystem.
There are 3 events that are listed in the `diff`: There are 3 events that are listed in the `diff`:
1. `A` - Add 1. `A` - Add