Documentation ¶
Overview ¶
Package siglistener provides signal listening as a module.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func New ¶
Example ¶
package main import ( "fmt" "os" "syscall" "time" "github.com/elisasre/go-common/service" "github.com/elisasre/go-common/service/module/siglistener" ) func main() { // Send SIGINT after 1 second. go func() { time.Sleep(time.Second) syscall.Kill(syscall.Getpid(), syscall.SIGINT) //nolint: errcheck }() s := siglistener.New(os.Interrupt) err := service.Run(service.Modules{s}) if err != nil { fmt.Println(err) return } fmt.Println("Service exited successfully") }
Output: Service exited successfully
Click to show internal directories.
Click to hide internal directories.