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
@@ -382,6 +382,12 @@ func (c *Command) Run(args []string) int {
|
||||
const op = "dev.(Command).Run"
|
||||
c.CombineLogs = c.flagCombineLogs
|
||||
|
||||
defer func() {
|
||||
if err := c.RunShutdownFuncs(); err != nil {
|
||||
c.UI.Error(fmt.Errorf("Error running shutdown tasks: %w", err).Error())
|
||||
}
|
||||
}()
|
||||
|
||||
var err error
|
||||
|
||||
f := c.Flags()
|
||||
@@ -615,12 +621,6 @@ func (c *Command) Run(args []string) int {
|
||||
return base.CommandUserError
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err := c.RunShutdownFuncs(); err != nil {
|
||||
c.UI.Error(fmt.Errorf("Error running shutdown tasks: %w", err).Error())
|
||||
}
|
||||
}()
|
||||
|
||||
var opts []base.Option
|
||||
if c.flagCreateLoopbackHostPlugin {
|
||||
c.DevLoopbackHostPluginId = "pl_1234567890"
|
||||
|
||||
Reference in new issue
Block a user