github.com/elves/elvish@v0.15.0/pkg/sys/signals_unix.go (about) 1 // +build !windows,!plan9,!js 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://github.com/elves/elvish/issues/988. 23 signal.Ignore(syscall.SIGTTIN, syscall.SIGTTOU, syscall.SIGTSTP) 24 return sigCh 25 }