Files
tendermint/test/e2e/runner/exec.go
Thane Thomson deb60d59b5 e2e: Extract Docker-specific functionality
Extract Docker-specific functionality and put it behind an interface
that should hopefully, without too much modification, allow us to
implement a Digital Ocean-based infrastructure provider.

Signed-off-by: Thane Thomson <connect@thanethomson.com>
2022-06-14 12:02:36 -04:00

31 lines
616 B
Go

//nolint: gosec
package main
import (
"fmt"
"os"
osexec "os/exec"
)
// execute executes a shell command.
func exec(args ...string) error {
cmd := osexec.Command(args[0], args[1:]...)
out, err := cmd.CombinedOutput()
switch err := err.(type) {
case nil:
return nil
case *osexec.ExitError:
return fmt.Errorf("failed to run %q:\n%v", args, string(out))
default:
return err
}
}
// execVerbose executes a shell command while displaying its output.
func execVerbose(args ...string) error {
cmd := osexec.Command(args[0], args[1:]...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}