diff --git a/sys/sys.go b/sys/sys.go index 3f20fe0..e76b876 100644 --- a/sys/sys.go +++ b/sys/sys.go @@ -59,13 +59,17 @@ func ManageStatusCmd(cmd *exec.Cmd, err error) int { return -1 } -func RunInteractiveCmd(cmd string, withStderr bool) int { +func RunInteractiveCmd(cmd string, withStderr bool, buffers ...io.Writer) int { // fmt.Printf(" == go before command : %s\n", cmd) icmd := exec.Command("bash", "-c", cmd) icmd.Stdin = os.Stdin icmd.Stdout = os.Stdout if withStderr { - icmd.Stderr = os.Stderr + if len(buffers) > 0 { + icmd.Stderr = buffers[0] + } else { + icmd.Stderr = os.Stderr + } } return ManageStatusCmd(icmd, icmd.Run()) }