adding exec_extra
This commit is contained in:
parent
cf50c65438
commit
3135507e1b
13
exec_extra/func.go
Normal file
13
exec_extra/func.go
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user