parent
5ab19ea469
commit
286b7836fa
|
@ -13,7 +13,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
|
@ -105,11 +104,6 @@ func (c *comm) Start(cmd *packer.RemoteCmd) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// A channel to keep track of our done state
|
|
||||||
doneCh := make(chan struct{})
|
|
||||||
sessionLock := new(sync.Mutex)
|
|
||||||
timedOut := false
|
|
||||||
|
|
||||||
// Start a goroutine to wait for the session to end and set the
|
// Start a goroutine to wait for the session to end and set the
|
||||||
// exit boolean and status.
|
// exit boolean and status.
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -130,18 +124,7 @@ func (c *comm) Start(cmd *packer.RemoteCmd) (err error) {
|
||||||
exitStatus = -1
|
exitStatus = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionLock.Lock()
|
|
||||||
defer sessionLock.Unlock()
|
|
||||||
|
|
||||||
if timedOut {
|
|
||||||
// We timed out, so set the exit status to -1
|
|
||||||
exitStatus = -1
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("remote command exited with '%d': %s", exitStatus, cmd.Command)
|
|
||||||
cmd.SetExited(exitStatus)
|
cmd.SetExited(exitStatus)
|
||||||
close(doneCh)
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue