diff --git a/pkg/os/process/process_execution/process_execution.go b/pkg/os/process/process_execution/process_execution.go new file mode 100644 index 0000000..68fb90a --- /dev/null +++ b/pkg/os/process/process_execution/process_execution.go @@ -0,0 +1,14 @@ +package process_execution + +import "os/exec" + +func ExecuteAndGetOutput(command string, args ...string) (string, error) { + outputBytes, err := exec.Command(command, args...).CombinedOutput() + outputString := "" + + if outputBytes != nil && len(outputBytes) > 0 { + outputString = string(outputBytes) + } + + return outputString, err +}