signal

go func() {
    c := make(chan os.Signal)
    signal.Notify(c, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
    <-c
    close(ss)
}()

你可能感兴趣的:(signal)