Docker executes the specified docker command
(cmd icmd.Cmd, cmdOperators ...CmdOperator)
| 94 | |
| 95 | // Docker executes the specified docker command |
| 96 | func Docker(cmd icmd.Cmd, cmdOperators ...CmdOperator) *icmd.Result { |
| 97 | for _, op := range cmdOperators { |
| 98 | deferFn := op(&cmd) |
| 99 | if deferFn != nil { |
| 100 | defer deferFn() |
| 101 | } |
| 102 | } |
| 103 | cmd.Command = append([]string{testEnv.DockerBinary()}, cmd.Command...) |
| 104 | if err := validateArgs(cmd.Command...); err != nil { |
| 105 | return &icmd.Result{ |
| 106 | Error: err, |
| 107 | } |
| 108 | } |
| 109 | return icmd.RunCmd(cmd) |
| 110 | } |
| 111 | |
| 112 | // validateArgs is a checker to ensure tests are not running commands which are |
| 113 | // not supported on platforms. Specifically on Windows this is 'busybox top'. |
searching dependent graphs…