Merge pull request #1158 from mfischer-zd/fix_1155

lock.go: fix race condition
This commit is contained in:
Armon Dadgar 2015-08-05 14:56:13 -07:00
commit c2a865686c
1 changed files with 2 additions and 1 deletions

View File

@ -282,13 +282,14 @@ func (c *LockCommand) startChild(script string, doneCh chan struct{}) error {
cmd.Stderr = os.Stderr
// Start the child process
c.childLock.Lock()
if err := cmd.Start(); err != nil {
c.Ui.Error(fmt.Sprintf("Error starting handler: %s", err))
c.childLock.Unlock()
return err
}
// Setup the child info
c.childLock.Lock()
c.child = cmd.Process
c.childLock.Unlock()