package utils import ( "bytes" "os/exec" "github.com/hashicorp/hcl/v2" ) func CheckErr(e error) { if e != nil { panic(e) } } func CheckDiags(diag hcl.Diagnostics) { if diag.HasErrors() { panic(diag.Error()) } } // Execute a system command ... func RunSystemCommand(name string, arg ...string) ([]byte, []byte, error) { var stdOut bytes.Buffer var stdErr bytes.Buffer cmd := exec.Command(name, arg...) cmd.Stderr = &stdErr cmd.Stdout = &stdOut err := cmd.Run() return stdOut.Bytes(), stdErr.Bytes(), err }