https://github.com/aklinkert/go-exitcontext
Provides an easy way of handling exit signals in go by providing a context
https://github.com/aklinkert/go-exitcontext
exit exitcode exitcontext golang golang-library golang-package signal signals
Last synced: 9 months ago
JSON representation
Provides an easy way of handling exit signals in go by providing a context
- Host: GitHub
- URL: https://github.com/aklinkert/go-exitcontext
- Owner: aklinkert
- License: mit
- Created: 2019-01-31T15:20:18.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-18T08:34:28.000Z (almost 6 years ago)
- Last Synced: 2023-08-12T07:41:21.552Z (over 2 years ago)
- Topics: exit, exitcode, exitcontext, golang, golang-library, golang-package, signal, signals
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-exitcontext
This package provides functions to create a context that listens for `SIG_` signals and cancels the context, used to abort programs by sending signals.
# Usage
If you already have a context and want to recycle that one:
```go
ctx := context.Background()
exitCtx := exitcontext.NewWithContext(ctx)
```
else just use the new method, which creates a `context.Background()` under the hood:
```go
exitCtx := exitcontext.New()
```
## License
MIT License
Copyright (c) 2019 Alexander Pinnecke