14 lines
252 B
Go
14 lines
252 B
Go
|
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
|
||
|
}
|