sys - amend RunInteractiveCmd
This commit is contained in:
parent
bb1c03b1a1
commit
39fdda840c
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user