-
Notifications
You must be signed in to change notification settings - Fork 99
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
return stdout & stdin when using docker compose #404
Conversation
had to invert the quiet in some places because: run expects a True if it is to be captured but wrapper sends quiet as false when it is to be captured enable capturing on build and pull, if needed, client may set --quiet flag via the quiet option (note: not the same as quiet on up and down) and simply ignore returned value(s)
Thank you for the pull request. Since this is touching the public api in a non-trivial manner, I'll give myself some time to think about it. Since we want to garantee backward compatibility, we don't want to put ourselves back against a wall |
Further to this it seems docker compose actually writes to STDERR instead of STDOUT in many cases. When I apply @Sid-Sun's patch locally and run a If I pass return_stderr to the run method in It returns a list with stdout and stderr which I can then read. It would be great to also be given the option to capture_stderr with a new parameter on the various compose methods. |
Thanks for pointing this out. I wasn't aware of the return_stderr parameter, somewhat strange that capture doesn't necessarily imply return. Nevertheless if the change in API is acceptable, we can set return parameters to true and get the outputs. |
The capture arguments are correct in that they tell the run method to capture the subprocess output, but then the output is passed to If return_stderr isn't passed then it only processes stdout and not stderr. I agree that the |
I'm trying to understand the use case a bit better to make sure we get the API right. I totally understand the need for stderr and stdout when those are coming from a container (e.g. |
My specific use case is a terminal user interface which takes over the entire terminal (like htop or a curses app). Anything that writes directly to the terminal breaks the rendering of my app. I'm only using up and down at the moment, for something like build which takes a while I'd need direct access to the subprocess output stream rather than waiting for it to complete. |
+1 For this PR. I'm building a GUI app which interacts with docker compose a lot and i would like to be able to capture the stderr/stdout to analyse in case of errors. |
Sorry for the silence on my part. I'd totally forgotten about that issue, which is non-trivial. I'll take a look tomorrow and continue this PR, or create another one to have a better handling of stderr and stdout. |
Ok so I took a look at it, and here is how it should go. If the user set in any function When If a function already has a All of that is possible with the function To help with the conditional type return, we should use the Does that work for all people involed who wanted this feature? |
Seems amazing to me. Thanks |
Hi people, it took some time, but I started working on this. See #494 . I'll work on doing the same with the other functions. |
#496 for |
I'll close this pull request, you can follow the progress in this issue: #499 |
patch introduces support to return captured stdout & stdin when doing pull, down, up, build (targets #395)
had to invert the quiet in some places because:
run expects a True if it is to be captured but
wrapper sends quiet as false when it is to be captured
enable capturing on build and pull, if needed, client may set --quiet flag via the quiet option (note: not the same as quiet on up and down) and simply ignore returned value(s)