This repository was archived by the owner on Feb 8, 2021. It is now read-only.
read until EOF in streamCopy #498
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If either stdoutPipe or stderrPipe reads to EOF, do not close the other
one so that it can read to EOF as well. Otherwise we might lose output
in the other pipe.
This works because if runv ends the stdout/stderr streams, it always
closes the writer part of both pipes. Then io.Copy() will get EOF and
return success here.
Also no need to wait stdin go routine because streamCopy() runs in a go
routine itself thus no one is really waiting out there.
Some observations found during looking at io.Pipe() source code:
So streamCopy() cannot close stdout/stderr pipes from the reader side and expect io.Copy() to still read buffered data from them.
This might fix the failure in http://ci.hypercontainer.io:8080/job/hyperd-auto/404/console