Fix #6240 by way of an update to github.com/masterzen/winrm (& winrm/soap)
$ govendor fetch -v github.com/masterzen/winrm $ govendor fetch -v github.com/masterzen/winrm/soap * In #6240 users reported problems that could be traced to the use of RunWithString in communicator/winrm/communicator.go. * https://github.com/masterzen/winrm/pull/78 apparently fixed a race condition in RunWithString that only materialises with Go <= 1.10; This is possibly why we are only seeing this with recent releases. Additionally, the intermittent nature of the errors and error messages seen are indicative of this type of problem... so here's hoping this fixes things...
This commit is contained in:
parent
6189d66e77
commit
aeadd039b7
|
@ -152,10 +152,20 @@ func (c *Client) RunWithString(command string, stdin string) (string, string, in
|
||||||
}
|
}
|
||||||
|
|
||||||
var outWriter, errWriter bytes.Buffer
|
var outWriter, errWriter bytes.Buffer
|
||||||
go io.Copy(&outWriter, cmd.Stdout)
|
var wg sync.WaitGroup
|
||||||
go io.Copy(&errWriter, cmd.Stderr)
|
wg.Add(2)
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
io.Copy(&outWriter, cmd.Stdout)
|
||||||
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
io.Copy(&errWriter, cmd.Stderr)
|
||||||
|
}()
|
||||||
|
|
||||||
cmd.Wait()
|
cmd.Wait()
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
return outWriter.String(), errWriter.String(), cmd.ExitCode(), cmd.err
|
return outWriter.String(), errWriter.String(), cmd.ExitCode(), cmd.err
|
||||||
}
|
}
|
||||||
|
@ -176,11 +186,24 @@ func (c Client) RunWithInput(command string, stdout, stderr io.Writer, stdin io.
|
||||||
return 1, err
|
return 1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
go io.Copy(cmd.Stdin, stdin)
|
var wg sync.WaitGroup
|
||||||
go io.Copy(stdout, cmd.Stdout)
|
wg.Add(3)
|
||||||
go io.Copy(stderr, cmd.Stderr)
|
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
io.Copy(cmd.Stdin, stdin)
|
||||||
|
}()
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
io.Copy(stdout, cmd.Stdout)
|
||||||
|
}()
|
||||||
|
go func() {
|
||||||
|
defer wg.Done()
|
||||||
|
io.Copy(stderr, cmd.Stderr)
|
||||||
|
}()
|
||||||
|
|
||||||
cmd.Wait()
|
cmd.Wait()
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
return cmd.ExitCode(), cmd.err
|
return cmd.ExitCode(), cmd.err
|
||||||
|
|
||||||
|
|
|
@ -988,16 +988,16 @@
|
||||||
"revision": "95ba30457eb1121fa27753627c774c7cd4e90083"
|
"revision": "95ba30457eb1121fa27753627c774c7cd4e90083"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "8z5kCCFRsBkhXic9jxxeIV3bBn8=",
|
"checksumSHA1": "dVQEUn5TxdIAXczK7rh6qUrq44Q=",
|
||||||
"path": "github.com/masterzen/winrm",
|
"path": "github.com/masterzen/winrm",
|
||||||
"revision": "a2df6b1315e6fd5885eb15c67ed259e85854125f",
|
"revision": "7e40f93ae939004a1ef3bd5ff5c88c756ee762bb",
|
||||||
"revisionTime": "2017-08-14T13:39:27Z"
|
"revisionTime": "2018-02-24T16:03:50Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "XFSXma+KmkhkIPsh4dTd/eyja5s=",
|
"checksumSHA1": "XFSXma+KmkhkIPsh4dTd/eyja5s=",
|
||||||
"path": "github.com/masterzen/winrm/soap",
|
"path": "github.com/masterzen/winrm/soap",
|
||||||
"revision": "a2df6b1315e6fd5885eb15c67ed259e85854125f",
|
"revision": "7e40f93ae939004a1ef3bd5ff5c88c756ee762bb",
|
||||||
"revisionTime": "2017-08-14T13:39:27Z"
|
"revisionTime": "2018-02-24T16:03:50Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "NkbetqlpWBi3gP08JDneC+axTKw=",
|
"checksumSHA1": "NkbetqlpWBi3gP08JDneC+axTKw=",
|
||||||
|
|
Loading…
Reference in New Issue