forked from TrueCloudLab/restic
backup: In case of error also Wait() for terminal goroutine
This prevents a race condition where the final summary message can get lost.
This commit is contained in:
parent
d686fa25de
commit
18fccb5995
2 changed files with 11 additions and 4 deletions
7
changelog/unreleased/pull-3305
Normal file
7
changelog/unreleased/pull-3305
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Bugfix: In case of error also Wait() for terminal goroutine
|
||||||
|
|
||||||
|
This prevents a race condition where the final summary message is
|
||||||
|
lost. When using --json output it happened from time to time that the
|
||||||
|
summary output was missing.
|
||||||
|
|
||||||
|
https://github.com/restic/restic/pull/3305
|
|
@ -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 })
|
t.Go(func() error { term.Run(t.Context(globalOptions.ctx)); return nil })
|
||||||
|
|
||||||
err := runBackup(backupOptions, globalOptions, term, args)
|
err := runBackup(backupOptions, globalOptions, term, args)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
t.Kill(nil)
|
t.Kill(nil)
|
||||||
return t.Wait()
|
if werr := t.Wait(); werr != nil {
|
||||||
|
panic(fmt.Sprintf("term.Run() returned err: %v", err))
|
||||||
|
}
|
||||||
|
return err
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue