mirror of
https://github.com/rclone/rclone.git
synced 2024-11-08 01:25:14 +01:00
6b7d7d0441
When rclone received a SIGINT (Ctrl+C) or SIGTERM signal while an atexit function is registered it always terminated with status code 0. Unix convention is to exit with a non-zero status code. Often it's `128 + int(signum), but at least not zero. With this change fatal signals handled by the `atexit` package cause a non-zero exit code. On Unix systems it's `128 + int(signum)` while on other systems, such as Windows, it's always 2 ("error not otherwise categorised"). Resolves #5437. Signed-off-by: Michael Hanselmann <public@hansmi.ch>
16 lines
216 B
Go
16 lines
216 B
Go
//+build windows plan9
|
|
|
|
package atexit
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/rclone/rclone/lib/exitcode"
|
|
)
|
|
|
|
var exitSignals = []os.Signal{os.Interrupt}
|
|
|
|
func exitCode(_ os.Signal) int {
|
|
return exitcode.UncategorizedError
|
|
}
|