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
1 changed files with 8 additions and 2 deletions

View File

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