bug(cmd): Ensure RunShutdownFuncs is called when an early error occurs (#2333)
* bug(cmd): Ensure RunShutdownFuncs is called when an early error occurs
This commit is contained in:
1 parent
4d966c8eb4
commit
dcccaf1bcf
4 files changed
+22
-12
No files matched your search
@@ -177,6 +177,12 @@ func (c *InitCommand) Run(args []string) (retCode int) {
|
||||
return result
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err := c.RunShutdownFuncs(); err != nil {
|
||||
c.UI.Error(fmt.Errorf("Error running shutdown tasks: %w", err).Error())
|
||||
}
|
||||
}()
|
||||
|
||||
if c.configWrapperCleanupFunc != nil {
|
||||
defer func() {
|
||||
if err := c.configWrapperCleanupFunc(); err != nil {
|
||||
|
||||
Reference in new issue
Block a user