mirror of https://github.com/docker/cli.git
fix tcp half-closed connection unreliability in WSL
Signed-off-by: Seongbin Hong <vertex@g.cnu.ac.kr>
This commit is contained in:
parent
5777c1bd53
commit
2e01d90774
|
@ -48,6 +48,13 @@ func (h *hijackedIOStreamer) stream(ctx context.Context) error {
|
||||||
outputDone := h.beginOutputStream(restoreInput)
|
outputDone := h.beginOutputStream(restoreInput)
|
||||||
inputDone, detached := h.beginInputStream(restoreInput)
|
inputDone, detached := h.beginInputStream(restoreInput)
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
// Close the pipe after the outputStream had done.
|
||||||
|
if err := h.resp.CloseWrite(); err != nil {
|
||||||
|
logrus.Debugf("Couldn't send EOF: %s", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case err := <-outputDone:
|
case err := <-outputDone:
|
||||||
return err
|
return err
|
||||||
|
@ -167,11 +174,6 @@ func (h *hijackedIOStreamer) beginInputStream(restoreInput func()) (doneC <-chan
|
||||||
logrus.Debugf("Error sendStdin: %s", err)
|
logrus.Debugf("Error sendStdin: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := h.resp.CloseWrite(); err != nil {
|
|
||||||
logrus.Debugf("Couldn't send EOF: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
close(inputDone)
|
close(inputDone)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue