[go: up one dir, main page]

Skip to content
/ ctrlc Public

Go library that provides an easy way of having a task that is context-aware and deals with SIGINT and SIGTERM signals

License

Notifications You must be signed in to change notification settings

caarlos0/ctrlc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

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
    })
}

About

Go library that provides an easy way of having a task that is context-aware and deals with SIGINT and SIGTERM signals

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages