sys - amend RunInteractiveCmd

This commit is contained in:
Mahdi Abu Yasmine 2023-11-07 01:56:10 +01:00
parent 0cf4755502
commit bb1c03b1a1

View File

@ -60,7 +60,7 @@ func ManageStatusCmd(cmd *exec.Cmd, err error) int {
} }
func RunInteractiveCmd(cmd string, withStderr bool) int { func RunInteractiveCmd(cmd string, withStderr bool) int {
fmt.Printf(" == go before command : %s\n", cmd) // fmt.Printf(" == go before command : %s\n", cmd)
icmd := exec.Command("bash", "-c", cmd) icmd := exec.Command("bash", "-c", cmd)
icmd.Stdin = os.Stdin icmd.Stdin = os.Stdin
icmd.Stdout = os.Stdout icmd.Stdout = os.Stdout
@ -71,7 +71,7 @@ func RunInteractiveCmd(cmd string, withStderr bool) int {
} }
func PipeCmd(cmd1 *exec.Cmd, cmd2 *exec.Cmd, buffers ...io.Writer) { func PipeCmd(cmd1 *exec.Cmd, cmd2 *exec.Cmd, buffers ...io.Writer) {
fmt.Println("> Pipe Commands") // fmt.Println("> Pipe Commands")
if len(buffers) > 0 { if len(buffers) > 0 {
pr, pw := io.Pipe() pr, pw := io.Pipe()
cmd1.Stdout = pw cmd1.Stdout = pw
@ -96,7 +96,7 @@ func PipeCmd(cmd1 *exec.Cmd, cmd2 *exec.Cmd, buffers ...io.Writer) {
if err2 != nil { if err2 != nil {
fmt.Printf("error2 : %v\n", err2) fmt.Printf("error2 : %v\n", err2)
} }
fmt.Println("< Pipe Commands") // fmt.Println("< Pipe Commands")
} }
} }