adding exec_extra

This commit is contained in:
brent s. 2020-09-26 02:17:33 -04:00
parent cf50c65438
commit 3135507e1b
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
2 changed files with 13 additions and 0 deletions

13
exec_extra/func.go Normal file
View File

@ -0,0 +1,13 @@
package exec_extra

import (
`os/exec`
)

func ExecCmdReturn(cmd *exec.Cmd) (exitStatus int, err error) {
// https://stackoverflow.com/a/55055100/733214
err = cmd.Run()
exitErr, _ := err.(*exec.ExitError)
exitStatus = exitErr.ExitCode()
return
}