Documentation
¶
Overview ¶
Package atexit lets you define handlers when the program exits.
Add handlers using Register. You must call atexit.Exit to get the handler invoked (and then terminate the program).
This package also provides replacements to log.Fatal, log.Fatalf and log.Fatalln.
Example:
package main import ( "fmt" "github.com/tebeka/atexit" ) func handler() { fmt.Println("Exiting") } func main() { atexit.Register(handler) atexit.Exit(0) }
Index ¶
Constants ¶
View Source
const (
// Version is package version
Version = "0.3.0"
)
Variables ¶
This section is empty.
Functions ¶
func Exit ¶
func Exit(code int)
Exit runs all the atexit handlers and then terminates the program using os.Exit(code)
func Fatal ¶
func Fatal(v ...interface{})
Fatal runs all the atexit handler then calls log.Fatal (which will terminate the program)
Types ¶
Click to show internal directories.
Click to hide internal directories.