From f3bbe8d33f592e7f9b326f9ab9d1eb3052084bb4 Mon Sep 17 00:00:00 2001 From: Li Kexian Date: Wed, 12 Feb 2020 23:34:51 +0800 Subject: [PATCH] command/workspace delete: release lock after workspace removal warning (#24085) --- command/workspace_delete.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/command/workspace_delete.go b/command/workspace_delete.go index a8639b3aed..e57fbe32b5 100644 --- a/command/workspace_delete.go +++ b/command/workspace_delete.go @@ -119,6 +119,8 @@ func (c *WorkspaceDeleteCommand) Run(args []string) int { } if err := stateMgr.RefreshState(); err != nil { + // We need to release the lock before exit + stateLocker.Unlock(nil) c.Ui.Error(err.Error()) return 1 } @@ -126,6 +128,8 @@ func (c *WorkspaceDeleteCommand) Run(args []string) int { hasResources := stateMgr.State().HasResources() if hasResources && !force { + // We need to release the lock before exit + stateLocker.Unlock(nil) c.Ui.Error(fmt.Sprintf(strings.TrimSpace(envNotEmpty), workspace)) return 1 }