elvish/pkg/sys/signal_unix.go
Qi Xiao f7cb556d9b Require Go 1.18.
- Run "go fix" to remove legacy build tags

- Use staticcheck@master until it has a release that supports Go 1.18

- Turn off autocrlf for Windows tasks
2022-03-20 15:28:23 +00:00

26 lines
678 B
Go

//go:build !windows && !plan9 && !js
package sys
import (
"os"
"os/signal"
"syscall"
)
func notifySignals() chan os.Signal {
// This catches every signal regardless of whether it is ignored.
sigCh := make(chan os.Signal, sigsChanBufferSize)
signal.Notify(sigCh)
// Calling signal.Notify will reset the signal ignore status, so we need to
// call signal.Ignore every time we call signal.Notify.
//
// TODO: Remove this if, and when, job control is implemented. This
// handles the case of running an external command from an interactive
// prompt.
//
// See https://b.elv.sh/988.
signal.Ignore(syscall.SIGTTIN, syscall.SIGTTOU, syscall.SIGTSTP)
return sigCh
}