Closed m9rco closed 4 years ago
I think you can ignore the signal signal is acquired by the way, but in fact
var (
ch chan os.Signal
status os.Signal
)
ch = make(chan os.Signal, 1)
signal.Notify(ch,
syscall.SIGTTIN, syscall.SIGTTOU, syscall.SIGHUP, syscall.SIGUSR1, syscall.SIGQUIT,
syscall.SIGTERM, syscall.SIGINT, syscall.SIGTSTP, syscall.SIGCONT)
signal.Ignore(syscall.SIGTSTP)
for {
select {
case status = <-ch:
fmt.Println(status)
switch status {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
return
case syscall.SIGHUP:
fmt.Println("SIGHUP")
continue
case syscall.SIGCONT:
fmt.Println("SIGCONT")
continue
case syscall.SIGUSR1:
case syscall.SIGTSTP:
fmt.Println("SIGTSTP")
continue
case syscall.SIGSTOP:
fmt.Println("SIGSTOP")
continue
default:
fmt.Println(status)
continue
}
}
}
Are you asking for help writing Go code to ignore SIGTSTP? If, yes, then you're probably looking for stackoverflow.com or the golang-nuts mailing list.
Are you asking if the elvish shell can be made to ignore SIGTSTP? If, yes, then note that elvish currently does ignore SIGTSTP based on a quick interactive test.
yes ,I want to know how the elvish,stackoverflow.com is answer can't elvish ignore SIGTSTP
Elvish does not handle SIGTSTP specifically. Instead, it listens on all signals, which has the side effect of suppressing the default handling of SIGTSTP:
Hi.
I recently doing a restricted shell, Think through golang development, but I don't want to elvish based, because this project will be very large,In fact, I just want to know how to circumvent the CTRL -z signal is elvish