workgroups/vendor/github.com/caarlos0/ctrlc/README.md
Marvin Preuss 1d4ae27878
All checks were successful
continuous-integration/drone/push Build is passing
ci: drone yaml with reusable anchors
2021-09-24 17:34:17 +02:00

24 lines
429 B
Markdown

# ctrlc
CTRL-C is a Go library that provides an easy way of having a task that
is context-aware and deals with SIGINT and SIGTERM signals.
## Usage
```go
package main
import "context"
import "github.com/caarlos0/ctrlc"
func main() {
ctx, cancel := context.WithTimeout(context.Backgroud(), time.Second)
defer cancel()
ctrlc.Default.Run(ctx, func() error {
// do something
return nil
})
}
```