feature: added process utils
parent
34e5061740
commit
be72ffec43
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue