-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DockerLogsContainer does not copy container output to stdout if used with tee (pipe) #1181
Comments
It's possible that the implementation of the task doesn't properly flush the stream. Would you be interested in investigating the issue? |
We have a functional test for this: `DockerLogsContainerFunctionalTest."Can start a container and watch logs". We'd have to see your specific use case and the output you'd expect to see. Do you have a reproducible example? |
I do:
Now run
And now run it with
The console output will stop somewhere in between while
Additionally in the log output in contrast to |
Was the second command meant to be a Gradle command? RE: Empty new lines. I don't see anything in the task's implementation that would cause it. But I didn't dig very deep. As mentioned before, I am not planning to look into this. If you want a fix then you'll need to provide a PR. |
Yeah sorry, my fault, that should read |
I actually see multiple concerns here:
|
|
Feel free to open a separate issue and change the issue description here. Heads up: I do not have to time to work on it but maybe someone else in the community wants to pick it up. |
If using e.g. this task:
it does copy the content of "docker logs -f XXX" to the gradle stdout like expected if you run:
gradle logContainer
But if you run:
gradle logContainer | tee output.txt
where I would expect the same behavior just that it will be on stdout and on output.txt the output.txt does miss the whole stdout output from the container.
The last thing in the output.txt is:
and that's all - the container output is missing.
The whole output is also not printed to stdout while the container logs does show it (observed with docker logs -f) but only when the container has finished.
I would expect that tee is transparent here like it is for other tools which write something to stdout.
Reproducer:
Just run a logContainer image which does output something to stdout and use tee to pipe it to a file too.
Your Environment
JDK17, Gradle 8.1.1, plugin version 9.3.1.
The text was updated successfully, but these errors were encountered: