src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/sys/signal_unix.go (about) 1 //go:build unix 2 3 package sys 4 5 import ( 6 "os" 7 "os/signal" 8 "syscall" 9 ) 10 11 func notifySignals() chan os.Signal { 12 // This catches every signal regardless of whether it is ignored. 13 sigCh := make(chan os.Signal, sigsChanBufferSize) 14 signal.Notify(sigCh) 15 // Calling signal.Notify will reset the signal ignore status, so we need to 16 // call signal.Ignore every time we call signal.Notify. 17 // 18 // TODO: Remove this if, and when, job control is implemented. This 19 // handles the case of running an external command from an interactive 20 // prompt. 21 // 22 // See https://b.elv.sh/988. 23 signal.Ignore(syscall.SIGTTIN, syscall.SIGTTOU, syscall.SIGTSTP) 24 return sigCh 25 }