MCPcopy Create free account
hub / github.com/cortexproject/cortex / Exec

Method Exec

integration/e2e/service.go:369–384  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

367// service. It returns the stdout, stderr, and error response from attempting
368// to run the command.
369func (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.

Callers

nothing calls this directly

Calls 3

containerNameMethod · 0.95
RunMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected