Merge pull request #5363 from zmanda/fix-gh-5258-backup-exits-with-wrong-code-on-ctrl-c

bugfix: fatal errors do not keep underlying error
This commit is contained in:
Michael Eischer
2025-09-24 22:04:38 +02:00
committed by GitHub
8 changed files with 63 additions and 13 deletions
+1 -1
View File
@@ -248,7 +248,7 @@ func copyTree(ctx context.Context, srcRepo restic.Repository, dstRepo restic.Rep
_, err = repository.Repack(ctx, srcRepo, dstRepo, packList, copyBlobs, bar, printer.P)
bar.Done()
if err != nil {
return errors.Fatal(err.Error())
return errors.Fatalf("%s", err)
}
return nil
}
+1 -1
View File
@@ -74,7 +74,7 @@ func (opts *DiffOptions) AddFlags(f *pflag.FlagSet) {
func loadSnapshot(ctx context.Context, be restic.Lister, repo restic.LoaderUnpacked, desc string) (*restic.Snapshot, string, error) {
sn, subfolder, err := restic.FindSnapshot(ctx, be, repo, desc)
if err != nil {
return nil, "", errors.Fatal(err.Error())
return nil, "", errors.Fatalf("%s", err)
}
return sn, subfolder, err
}
+1 -1
View File
@@ -110,7 +110,7 @@ func runInit(ctx context.Context, opts InitOptions, gopts GlobalOptions, args []
PackSize: gopts.PackSize * 1024 * 1024,
})
if err != nil {
return errors.Fatal(err.Error())
return errors.Fatalf("%s", err)
}
err = s.Init(ctx, version, gopts.password, chunkerPolynomial)
+2 -2
View File
@@ -351,7 +351,7 @@ func OpenRepository(ctx context.Context, opts GlobalOptions, printer progress.Pr
NoExtraVerify: opts.NoExtraVerify,
})
if err != nil {
return nil, errors.Fatal(err.Error())
return nil, errors.Fatalf("%s", err)
}
passwordTriesLeft := 1
@@ -478,7 +478,7 @@ func innerOpen(ctx context.Context, s string, gopts GlobalOptions, opts options.
rt, err := backend.Transport(globalOptions.TransportOptions)
if err != nil {
return nil, errors.Fatal(err.Error())
return nil, errors.Fatalf("%s", err)
}
// wrap the transport so that the throughput via HTTP is limited