summaryrefslogtreecommitdiffhomepage
path: root/pkg/atexit/atexit.go
blob: a349649e715db6223f5b7fbd2ecff1d941c232a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
package atexit

var hooks = []func(){}

func Register(f func()) {
	hooks = append(hooks, f)
}

func Exec() {
	for i := len(hooks) - 1; i >= 0; i-- {
		hooks[i]()
	}
}