terraform: defer unlock of lock in Stop to enure it always unlocks
This commit is contained in:
parent
83cc54bfbe
commit
5b42781117
|
@ -636,6 +636,7 @@ func (c *Context) Stop() {
|
||||||
log.Printf("[WARN] terraform: Stop called, initiating interrupt sequence")
|
log.Printf("[WARN] terraform: Stop called, initiating interrupt sequence")
|
||||||
|
|
||||||
c.l.Lock()
|
c.l.Lock()
|
||||||
|
defer c.l.Unlock()
|
||||||
|
|
||||||
// If we're running, then stop
|
// If we're running, then stop
|
||||||
if c.runContextCancel != nil {
|
if c.runContextCancel != nil {
|
||||||
|
@ -652,7 +653,6 @@ func (c *Context) Stop() {
|
||||||
// Grab the condition var before we exit
|
// Grab the condition var before we exit
|
||||||
if cond := c.runCond; cond != nil {
|
if cond := c.runCond; cond != nil {
|
||||||
cond.Wait()
|
cond.Wait()
|
||||||
c.l.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("[WARN] terraform: stop complete")
|
log.Printf("[WARN] terraform: stop complete")
|
||||||
|
|
Loading…
Reference in New Issue