Skip to content

Provides an easy way of handling exit signals in go by providing a context

License

Notifications You must be signed in to change notification settings

aklinkert/go-exitcontext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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:

ctx := context.Background()
exitCtx := exitcontext.NewWithContext(ctx)

else just use the new method, which creates a context.Background() under the hood:

exitCtx := exitcontext.New()

License

MIT License

Copyright (c) 2019 Alexander Pinnecke

About

Provides an easy way of handling exit signals in go by providing a context

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages