actually disable stdout/stderr. stdout>stderr (#1321)

* actually disable stdout/stderr. stdout>stderr

* for pure runner this turns it off for real this time.
* this also just makes the agent container type send stdout to stderr, since
we're not using stdout for function output anymore this is pretty
straightforward hopefully.
* I added a panic and some type checking printlns to ensure this is true for
pure_runner, both stdout and stderr are off, also added a unit test from agent
to ensure this behavior from its container type, which pure_runner utilizes
(no integration test though)
* tests ensure that logs still work if not trying to disable them (full agent)

* handle non ghost swapping
This commit is contained in:
Reed Allman
2018-11-21 15:04:53 -06:00
committed by GitHub
parent cf6cbb7a1d
commit bf2f96cbeb
5 changed files with 100 additions and 46 deletions

View File

@@ -283,19 +283,18 @@ func (drv *DockerDriver) removeContainer(ctx context.Context, container string)
// The docker driver will attempt to cast the task to a Auther. If that succeeds, private image support is available. See the Auther interface for how to implement this.
func (drv *DockerDriver) run(ctx context.Context, container string, task drivers.ContainerTask) (drivers.WaitResult, error) {
mwOut, mwErr := task.Logger()
stdout, stderr := task.Logger()
successChan := make(chan struct{})
_, stdinOff := task.Input().(common.NoopReadWriteCloser)
stdout, stderr := task.Logger()
_, stdoutOff := stdout.(common.NoopReadWriteCloser)
_, stderrOff := stderr.(common.NoopReadWriteCloser)
waiter, err := drv.docker.AttachToContainerNonBlocking(ctx, docker.AttachToContainerOptions{
Container: container,
InputStream: task.Input(),
OutputStream: mwOut,
ErrorStream: mwErr,
OutputStream: stdout,
ErrorStream: stderr,
Success: successChan,
Stream: true,
Stdout: !stdoutOff,