while I'm at it, kill this race condition in uploads, too
This commit is contained in:
parent
d8637751a3
commit
9ee97aaa2a
|
@ -132,7 +132,12 @@ func (c *communicator) Start(cmd *packer.RemoteCmd) (err error) {
|
|||
func (c *communicator) Upload(path string, r io.Reader, fi *os.FileInfo) (err error) {
|
||||
// Pipe the reader through to the connection
|
||||
streamId := c.mux.NextId()
|
||||
go serveSingleCopy("uploadData", c.mux, streamId, nil, r)
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
serveSingleCopy("uploadData", c.mux, streamId, nil, r)
|
||||
}()
|
||||
|
||||
args := CommunicatorUploadArgs{
|
||||
Path: path,
|
||||
|
@ -144,6 +149,7 @@ func (c *communicator) Upload(path string, r io.Reader, fi *os.FileInfo) (err er
|
|||
}
|
||||
|
||||
err = c.client.Call("Communicator.Upload", &args, new(interface{}))
|
||||
wg.Wait()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue