tebeka / atexit

atexit for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

atexit - Simple atexit implementation for Go

CI

Note that you have to call atexit.Exit and not os.Exit to terminate your program (that is, if you want the atexit handlers to execute).

Example usage

package main

import (
    "fmt"

    "github.com/tebeka/atexit"
)

func handler() {
    fmt.Println("Exiting")
}

func main() {
	atexit.Register(handler)
	atexit.Exit(0)
}

Install

go get github.com/tebeka/atexit

Contact

About

atexit for Go

License:MIT License


Languages

Language:Go 100.0%