move wait earlier
This commit is contained in:
parent
9ee97aaa2a
commit
b2d5fcd48a
|
@ -102,6 +102,7 @@ func (c *communicator) Start(cmd *packer.RemoteCmd) (err error) {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
conn, err := c.mux.Accept(responseStreamId)
|
conn, err := c.mux.Accept(responseStreamId)
|
||||||
|
wg.Wait()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERR] Error accepting response stream %d: %s",
|
log.Printf("[ERR] Error accepting response stream %d: %s",
|
||||||
responseStreamId, err)
|
responseStreamId, err)
|
||||||
|
@ -113,7 +114,6 @@ func (c *communicator) Start(cmd *packer.RemoteCmd) (err error) {
|
||||||
var finished CommandFinished
|
var finished CommandFinished
|
||||||
decoder := gob.NewDecoder(conn)
|
decoder := gob.NewDecoder(conn)
|
||||||
err = decoder.Decode(&finished)
|
err = decoder.Decode(&finished)
|
||||||
wg.Wait()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERR] Error decoding response stream %d: %s",
|
log.Printf("[ERR] Error decoding response stream %d: %s",
|
||||||
responseStreamId, err)
|
responseStreamId, err)
|
||||||
|
|
Loading…
Reference in New Issue