cleanup

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2017 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

* Convey * Copyright 2016-2017 Gary Kramlich <grim@reaperworld.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>.

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