cleanup

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cleanup handles cleanup tasks for cleaning up after a run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func()

Func is a function to run on exit (it should be quick).

type List

type List struct {
	// contains filtered or unexported fields
}

List is a list of things that should happen in case the program receives a signal. This should be things like making sure temp files are deleted, volumes are destroyed, etc.

func NewList

func NewList() *List

NewList will create a new List that will run all registered functions on SIGINT or SIGTERM.

func (*List) Add

func (c *List) Add(fn Func) func()

Add will register a function to be invoked on system exit unless the returned function is called. The given function is wrapped in the return function, so it can be used in its place. This function MUST be called in order to deregister it on exit if it cannot be called idempotently. The order of functions invoked on exit is not guaranteed to be stable.

Jump to

Keyboard shortcuts

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