move wait earlier

This commit is contained in:
Megan Marsh 2017-07-05 12:27:59 -07:00
parent 9ee97aaa2a
commit b2d5fcd48a
1 changed files with 1 additions and 1 deletions

View File

@ -102,6 +102,7 @@ func (c *communicator) Start(cmd *packer.RemoteCmd) (err error) {
go func() {
conn, err := c.mux.Accept(responseStreamId)
wg.Wait()
if err != nil {
log.Printf("[ERR] Error accepting response stream %d: %s",
responseStreamId, err)
@ -113,7 +114,6 @@ func (c *communicator) Start(cmd *packer.RemoteCmd) (err error) {
var finished CommandFinished
decoder := gob.NewDecoder(conn)
err = decoder.Decode(&finished)
wg.Wait()
if err != nil {
log.Printf("[ERR] Error decoding response stream %d: %s",
responseStreamId, err)