MCPcopy
hub / github.com/google/cadvisor / Run

Method Run

integration/framework/framework.go:422–442  ·  view source on GitHub ↗
(command string, args ...string)

Source from the content-addressed store, hash-verified

420}
421
422func (a shellActions) Run(command string, args ...string) (string, string) {
423 var cmd *exec.Cmd
424 if a.fm.Hostname().Host == "localhost" {
425 // Just run locally.
426 cmd = exec.Command(command, args...)
427 } else {
428 // We must SSH to the remote machine and run the command.
429 cmd = a.wrapSSH(command, args...)
430 }
431 var stdout bytes.Buffer
432 var stderr bytes.Buffer
433 cmd.Stdout = &stdout
434 cmd.Stderr = &stderr
435 klog.Infof("About to run - %v", cmd.Args)
436 err := cmd.Run()
437 if err != nil {
438 a.fm.T().Fatalf("Failed to run %q %v in %q with error: %q. Stdout: %q, Stderr: %s", command, args, a.fm.Hostname().Host, err, stdout.String(), stderr.String())
439 return "", ""
440 }
441 return stdout.String(), stderr.String()
442}
443
444func (a shellActions) RunStress(command string, args ...string) (string, string) {
445 var cmd *exec.Cmd

Callers

nothing calls this directly

Calls 6

wrapSSHMethod · 0.95
InfofMethod · 0.80
HostnameMethod · 0.65
RunMethod · 0.65
TMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected