mirror of
https://github.com/restic/restic.git
synced 2024-12-27 10:17:58 +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:
parent
c347431907
commit
0ed2401711
1 changed files with 8 additions and 2 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue