2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 12:55:18 +00:00

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) {
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)
}
}