exit

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package exit allows to register callbacks which are called on program exit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit

func Exit(code int)

Exit terminates the application via os.Exit but waits for all exit handlers to complete before calling os.Exit.

func Fatal

func Fatal(v ...interface{})

Fatal is a replacement for log.Fatal which will trigger the closure of all registered exit handlers and waits for their completion and then call os.Exit(1).

func Fatalf

func Fatalf(format string, v ...interface{})

Fatalf is a replacement for log.Fatalf and behaves like Fatal.

func Listen

func Listen(fn func(os.Signal))

Listen registers an exit handler which is called on SIGINT/SIGTERM or when Exit/Fatal/Fatalf is called. SIGHUP is ignored since that is usually used for triggering a reload of configuration which isn't supported but shouldn't kill the process either.

func Wait

func Wait()

Wait waits for all exit handlers to complete.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL