Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Latest commit

 

History

History
48 lines (30 loc) · 957 Bytes

README.md

File metadata and controls

48 lines (30 loc) · 957 Bytes

Wait a bit

Tiny library for manage you application shutdown in graceful way by catching the OS signals.

⚠️ This repository is now archived. Please use os/signal.NotifyContext instead

Documentation

Installation

go get -u github.com/heartwilltell/waitabit

Usage

package main

import (
    "log"
    "os"

    "github.com/heartwilltell/waitabit"
)


func main() { 
	
    // call your application here ...
    
    wait := waitabit.NewWait(os.Interrupt)
    wait.WaitWithFunc(func() {
        log.Println("Bye")
    })
    
    // or ...
    
    waitabit.NewWait(os.Interrupt).WaitWithFunc(func() {
    	log.Println("Bye")
    })
    
}