command/workspace delete: release lock after workspace removal warning (#24085)

This commit is contained in:
Li Kexian 2020-02-12 23:34:51 +08:00 committed by GitHub
parent b956e8ef35
commit f3bbe8d33f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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
}