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: about 18 hours 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 (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-11-12T11:07:34.000Z (6 months ago)
- Last Synced: 2026-01-12T01:38:35.660Z (4 months ago)
- Topics: exit, exitcode, exitcontext, golang, golang-library, golang-package, signal, signals
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 0
- 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 - present Alex Klinkert
```