aboutsummaryrefslogtreecommitdiffstats
path: root/util/interrupt/cleaner.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-10-27 11:51:50 +0200
committerMichael Muré <batolettre@gmail.com>2018-10-27 11:51:50 +0200
commit5653ae98e0a7ac4396ac4e840f88ccf7ccdf7d7f (patch)
treef1e5ed7127426371cea353738ee3c5e6b3940c74 /util/interrupt/cleaner.go
parent8be1078dd6400765a9b9202a81c40ede3ee01981 (diff)
downloadgit-bug-5653ae98e0a7ac4396ac4e840f88ccf7ccdf7d7f.tar.gz
interrupt: minor cleaning
Diffstat (limited to 'util/interrupt/cleaner.go')
-rw-r--r--util/interrupt/cleaner.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/util/interrupt/cleaner.go b/util/interrupt/cleaner.go
index 76c9d04d..75d6c390 100644
--- a/util/interrupt/cleaner.go
+++ b/util/interrupt/cleaner.go
@@ -7,13 +7,13 @@ import (
"syscall"
)
-// Cleaner type referes to a function with no inputs that returns an error
+// Cleaner type refers to a function with no inputs that returns an error
type Cleaner func() error
var cleaners []Cleaner
var active = false
-// RegisterCleaner is responsible for regisreting a cleaner function. When a function is registered, the Signal watcher is started in a goroutine.
+// RegisterCleaner is responsible for registering a cleaner function. When a function is registered, the Signal watcher is started in a goroutine.
func RegisterCleaner(f ...Cleaner) {
for _, fn := range f {
cleaners = append([]Cleaner{fn}, cleaners...)
@@ -25,8 +25,7 @@ func RegisterCleaner(f ...Cleaner) {
<-ch
// Prevent un-terminated ^C character in terminal
fmt.Println()
- fmt.Println("Cleaning")
- errl := Clean()
+ errl := clean()
for _, err := range errl {
fmt.Println(err)
}
@@ -36,8 +35,8 @@ func RegisterCleaner(f ...Cleaner) {
}
}
-// Clean invokes all registered cleanup functions, and returns a list of errors, if they exist.
-func Clean() (errorlist []error) {
+// clean invokes all registered cleanup functions, and returns a list of errors, if they exist.
+func clean() (errorlist []error) {
for _, f := range cleaners {
err := f()
if err != nil {