github.com/hazelops/ize@v1.1.12-0.20230915191306-97d7c0e48f11/pkg/term/interactive.go (about) 1 //go:build !windows 2 // +build !windows 3 4 package term 5 6 import ( 7 "os" 8 "os/exec" 9 "os/signal" 10 ) 11 12 func (r Runner) InteractiveRun(cmd *exec.Cmd) (err error) { 13 // Ignore interrupt signal otherwise the program exits. 14 signal.Ignore(os.Interrupt) 15 defer signal.Reset(os.Interrupt) 16 cmd.Dir = r.dir 17 if r.stdin != nil { 18 cmd.Stdin = r.stdin 19 } 20 cmd.Stdout = r.stdout 21 cmd.Stderr = r.stderr 22 return cmd.Run() 23 }