Revert buggy "feat: exit cleanly on sigterm/siginterr"

This reverts commit 3b9d475e89.
This commit is contained in:
yory8 2019-04-04 10:23:41 +02:00
parent 3e08a52468
commit d29c605f99

16
main.go
View file

@ -5,9 +5,7 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"os/signal"
"path" "path"
"syscall"
"gopkg.in/alecthomas/kingpin.v2" "gopkg.in/alecthomas/kingpin.v2"
) )
@ -42,20 +40,6 @@ func main() {
} }
if *asDemon { if *asDemon {
// exit cleanly on ctrl-C or kill
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
for range c {
// dump history to file so that other apps can query it
err = write(history, histfile)
if err != nil {
log.Fatal(err)
}
os.Exit(0)
}
}()
persist := !*noPersist persist := !*noPersist
if err := listen(history, histfile, persist, *max); err != nil { if err := listen(history, histfile, persist, *max); err != nil {
log.Fatal(err) log.Fatal(err)