MCPcopy Create free account
hub / github.com/efficientgo/e2e / Exec

Method Exec

env_docker.go:652–670  ·  view source on GitHub ↗

Exec runs the provided command against the docker container specified by this service.

(command Command, opts ...ExecOption)

Source from the content-addressed store, hash-verified

650// Exec runs the provided command against the docker container specified by this
651// service.
652func (d *dockerRunnable) Exec(command Command, opts ...ExecOption) error {
653 if !d.IsRunning() {
654 return errors.Newf("service %s is stopped", d.Name())
655 }
656
657 l := &LinePrefixLogger{prefix: d.Name() + "-exec: ", logger: d.logger}
658 o := ExecOptions{Stdout: l, Stderr: l}
659 for _, opt := range opts {
660 opt(&o)
661 }
662
663 args := []string{"exec", d.containerName()}
664 args = append(args, command.Cmd)
665 args = append(args, command.Args...)
666 cmd := d.env.exec("docker", args...)
667 cmd.Stdout = o.Stdout
668 cmd.Stderr = o.Stderr
669 return cmd.Run()
670}
671
672func (e *DockerEnvironment) existDockerNetwork() (bool, error) {
673 out, err := e.exec("docker", "network", "ls", "--quiet", "--filter", fmt.Sprintf("name=%s", e.networkName)).CombinedOutput()

Callers

nothing calls this directly

Calls 5

IsRunningMethod · 0.95
NameMethod · 0.95
containerNameMethod · 0.95
optStruct · 0.50
execMethod · 0.45

Tested by

no test coverage detected