Documentation ¶
Overview ¶
Package atexit implements a simple atexit library.
Example:
package main import ( "fmt" "bitbucket.org/JeremySchlatter/go-atexit" ) func main() { atexit.TrapSignals() defer atexit.CallExitFuncs() atexit.Run(func() { fmt.Println("exited") }) }
Example ¶
defer CallExitFuncs() Run(func() { fmt.Println("End") }) Run(func() { fmt.Println("Middle") }) fmt.Println("Beginning")
Output: Beginning Middle End
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallExitFuncs ¶
func CallExitFuncs()
CallExitFuncs calls all functions previously registered through Run, in reverse order.
func TrapSignals ¶
func TrapSignals()
TrapSignals registers a handler for SIGINT and SIGTERM that calls CallExitFuncs() followed by os.Exit(1).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.