os

package
v9.1.57+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit

func Exit(code int)

Exit will ultimately call os.Exit once any registered shutdown hooks run

func Getenv

func Getenv(name, def string) string

Getenv will return an environment variable if exists or default if not

func GetenvInt

func GetenvInt(name string, def int) int

GetenvInt returns an environment variable as a number

func IsInsideContainer

func IsInsideContainer() bool

IsInsideContainer returns true if the process is running inside a containerized environment like docker or kubernetes

func OnExit

func OnExit(handler OnExitFunc)

OnExit will register an OnExitFunc to be called in reverse order (LIFO) when the process exits. this handler will only get called if the program exits through Exit - however, a SIGINT or SIGTERM event should also signal OnExit handlers

Types

type OnExitFunc

type OnExitFunc func(code int)

OnExitFunc is a handler for registering for exit events

Jump to

Keyboard shortcuts

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