feature: added process utils
This commit is contained in:
parent
34e5061740
commit
be72ffec43
14
pkg/os/process/process_execution/process_execution.go
Normal file
14
pkg/os/process/process_execution/process_execution.go
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user