feature: added process utils

master
amorozov 2024-06-21 15:31:41 +03:00
parent 34e5061740
commit be72ffec43
1 changed files with 14 additions and 0 deletions

View File

@ -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
}