2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-11 07:41:03 +00:00

mount: fix exit code on cancellation

This commit is contained in:
Michael Eischer 2024-04-05 22:23:08 +02:00
parent 6f2a4dea21
commit 910927670f
2 changed files with 6 additions and 1 deletions

View File

@ -190,7 +190,7 @@ func runMount(ctx context.Context, opts MountOptions, gopts GlobalOptions, args
Warnf("unable to umount (maybe already umounted or still in use?): %v\n", err)
}
return nil
return ErrOK
case <-done:
// clean shutdown, nothing to do
}

View File

@ -25,6 +25,8 @@ func init() {
_, _ = maxprocs.Set()
}
var ErrOK = errors.New("ok")
// cmdRoot is the base command when no other command has been specified.
var cmdRoot = &cobra.Command{
Use: "restic",
@ -125,6 +127,9 @@ func main() {
if err == nil {
err = ctx.Err()
} else if err == ErrOK {
// ErrOK overwrites context cancelation errors
err = nil
}
switch {