From 3135507e1ba95e15702d3c328557068755212fc8 Mon Sep 17 00:00:00 2001 From: brent s Date: Sat, 26 Sep 2020 02:17:33 -0400 Subject: [PATCH] adding exec_extra --- exec_extra/func.go | 13 +++++++++++++ paths/{paths.go => func.go} | 0 2 files changed, 13 insertions(+) create mode 100644 exec_extra/func.go rename paths/{paths.go => func.go} (100%) diff --git a/exec_extra/func.go b/exec_extra/func.go new file mode 100644 index 0000000..c539c61 --- /dev/null +++ b/exec_extra/func.go @@ -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 +} diff --git a/paths/paths.go b/paths/func.go similarity index 100% rename from paths/paths.go rename to paths/func.go