Exec runs the provided against a the docker container specified by this service. It returns the stdout, stderr, and error response from attempting to run the command.
(command *Command)
| 367 | // service. It returns the stdout, stderr, and error response from attempting |
| 368 | // to run the command. |
| 369 | func (s *ConcreteService) Exec(command *Command) (string, string, error) { |
| 370 | args := []string{"exec", s.containerName()} |
| 371 | args = append(args, command.cmd) |
| 372 | args = append(args, command.args...) |
| 373 | |
| 374 | cmd := exec.Command("docker", args...) |
| 375 | var stdout bytes.Buffer |
| 376 | cmd.Stdout = &stdout |
| 377 | |
| 378 | var stderr bytes.Buffer |
| 379 | cmd.Stderr = &stderr |
| 380 | |
| 381 | err := cmd.Run() |
| 382 | |
| 383 | return stdout.String(), stderr.String(), err |
| 384 | } |
| 385 | |
| 386 | // NetworkContainerHost return the hostname of the container within the network. This is |
| 387 | // the address a container should use to connect to other containers. |
nothing calls this directly
no test coverage detected