diff --git a/changelog/unreleased/pull-3305 b/changelog/unreleased/pull-3305 new file mode 100644 index 000000000..da34ea95d --- /dev/null +++ b/changelog/unreleased/pull-3305 @@ -0,0 +1,6 @@ +Bugfix: Fix possibly missing backup summary of json output in case of error + +When using --json output it happened from time to time that the summary output +was missing in case an error occurred. This has been fixed. + +https://github.com/restic/restic/pull/3305 diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index ef03884ab..29169a018 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -60,11 +60,11 @@ Exit status is 3 if some source data could not be read (incomplete snapshot crea t.Go(func() error { term.Run(t.Context(globalOptions.ctx)); return nil }) err := runBackup(backupOptions, globalOptions, term, args) - if err != nil { - return err - } t.Kill(nil) - return t.Wait() + if werr := t.Wait(); werr != nil { + panic(fmt.Sprintf("term.Run() returned err: %v", err)) + } + return err }, }