Use docker’s stdcopy to ensure we don’t emit garbage bytes to stdout #57
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.
As per the
ContainerAttach()
docs, a container not using a TTY has stderr and stdout multiplexed into a single stream in a Docker-specific format.When running
act
and its stdout is not a terminal (e.g. when it's redirected to a file),DockerExecutorInput.logDockerOutput()
is invoked -- I've changed this to usegit.luolix.top/docker/docker/pkg/stdcopy.StdCopy
as per Docker's suggestion.Right now the issue is the tests pass when output is redirected to a file and fail when run directly in a terminal! ❗️ This is because of the following two conflicting pieces:
act/container/docker_run.go
Lines 89 to 97 in f2cb9e3
act/container/docker_run.go
Lines 170 to 171 in f2cb9e3
Honestly, I'm not sure what the purpose of the
NORAW
env var is. IfNORAW
is passed in, the tests will fail in even more spectacular ways. I would like to do the following, but wanted to run it by you first before submitting this PR:terminal.IsTerminal()
inattachContainer()
, we use the Docker API client to introspect the container and see if it is in TTY mode or not.Tty *bool
toNewDockerRunExecutorInput
and only fall back toterminal.IsTerminal()
if it is nil.What are your thoughts?