mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-04-21 08:02:41 +02:00
Hoist control for exiting script a level up
This commit is contained in:
@@ -188,12 +188,12 @@ func (s *script) withLabeledCommands(step lifecyclePhase, cb func() error) func(
|
||||
if s.cli == nil {
|
||||
return cb
|
||||
}
|
||||
return func() error {
|
||||
return func() (ret error) {
|
||||
if err := s.runLabeledCommands(fmt.Sprintf("docker-volume-backup.%s-pre", step)); err != nil {
|
||||
return fmt.Errorf("withLabeledCommands: %s: error running pre commands: %w", step, err)
|
||||
}
|
||||
defer func() {
|
||||
s.must(s.runLabeledCommands(fmt.Sprintf("docker-volume-backup.%s-post", step)))
|
||||
ret = s.runLabeledCommands(fmt.Sprintf("docker-volume-backup.%s-post", step))
|
||||
}()
|
||||
return cb()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user