From 0ed2401711a4dd50fedae13846af09616a440f7e Mon Sep 17 00:00:00 2001 From: George Armhold Date: Thu, 9 Nov 2017 07:16:01 -0500 Subject: [PATCH] exit 1 if received signal is other than SIGINT send cleanup msg to stderr, not stdout gh-1413 --- cmd/restic/cleanup.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/restic/cleanup.go b/cmd/restic/cleanup.go index 208effdbc..04875fe45 100644 --- a/cmd/restic/cleanup.go +++ b/cmd/restic/cleanup.go @@ -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) } }