Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 605 Bytes

README.md

File metadata and controls

27 lines (21 loc) · 605 Bytes

sigtx Build Status

This package provides an implementation proposal for this Go proposal: golang/go#21521.

Usage

package main

import (
	"context"
	"fmt"
  "os"
  "syscall"

	"github.com/markbates/sigtx"
)

func main() {
	ctx, cancel := sigtx.WithCancel(context.Background(), os.Interrupt, syscall.SIGTERM, syscall.SIGKILL)
	defer cancel()
	select {
	case <-ctx.Done():
		fmt.Println("thanks for stopping me")
	}
}