Thanks to visit codestin.com
Credit goes to github.com

Skip to content

leprosus/golang-sig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang handler of OS signals

The code helps you organise waiting and handling OS signals like for example: SIGINT, SIGTERM, SIGKILL

Create new handler

import sig "github.com/leprosus/golang-sig"

sig.WaitSig(func(){
	fmt.Println("Buy-buy World!")
}, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL)

NB: default handling signals are SIGINT, SIGTERM, SIGKILL.

It means you don't need to set them in the function if you need to work with them only.

You have to set them in a case of an extended signal list.

The code above will wait getting one of SIGINT, SIGTERM, SIGKILL from OS. After getting a signal callback will be executed.

About

Golang handler of OS signals

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages