cri-o/utils/utils.go

20 lines
269 B
Go
Raw Normal View History

package utils
import (
"bytes"
"os/exec"
)
func ExecCmd(name string, args ...string) (string, error) {
cmd := exec.Command(name, args...)
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
return "", err
}
return out.String(), nil
}