exit 1 if received signal is other than SIGINT

send cleanup msg to stderr, not stdout
gh-1413
This commit is contained in:
George Armhold 2017-11-09 07:16:01 -05:00
parent c347431907
commit 0ed2401711

View file

@ -73,8 +73,14 @@ func RunCleanupHandlers() {
func CleanupHandler(c <-chan os.Signal) { func CleanupHandler(c <-chan os.Signal) {
for s := range c { for s := range c {
debug.Log("signal %v received, cleaning up", s) debug.Log("signal %v received, cleaning up", s)
fmt.Printf("%sInterrupt received, cleaning up\n", ClearLine()) fmt.Fprintf(stderr, "%ssignal %v received, cleaning up\n", ClearLine(), s)
Exit(0)
code := 0
if s != syscall.SIGINT {
code = 1
}
Exit(code)
} }
} }