Führen Sie den Befehl aus
// ExecuteCommand execute cmd and returns the output
func ExecuteCommand(cmd string, args []string) ([]byte, error) {
cmd := exec.Command(cmd, args)
buf, err := cmd.CombinedOutput()
if err != nil {
return nil, fmt.Errorf("cmd run failed: %v, msg: %s", err, string(buf))
}
return string(buf), nil
}
Jealous Jellyfish