-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Expose the output_type option when streaming, and allow both stdout/stderr to be captured #209
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small change is OK! Could you please ensure that:
- you've run black and linting
- bump the version in version.py
- add a note to the CHANGELOG with the corresponding version
Thank you!
spython/utils/terminal.py
Outdated
@@ -122,12 +122,14 @@ def stream_command( | |||
sudo_options: string or list of strings that will be passed as options to sudo | |||
|
|||
""" | |||
if output_type not in ["stdout", "stderr"]: | |||
if output_type not in ["stdout", "stderr", "both"]: | |||
bot.exit("Invalid output type %s. Must be stderr or stdout." % output_type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bot.exit("Invalid output type %s. Must be stderr or stdout." % output_type) | |
bot.exit("Invalid output type %s. Must be stderr, stdout, or both" % output_type) |
Alright, I believe I have run black on the two changes, bumped the version and added to the change log. Please do let me know if there is anything else that comes to mind. This was a very quick read for me, and I have not explicitly tested this new code path. It is small enough where I think it is OK. |
if you are doing this for your own use and not adding a test here, I do need to ask you to at least test your local case (and show the result here). For black, I recommend we pin to 23.3.0 (before the big change that produced the error and re-run). |
I have added a unit test to the test suite that attempts to verify this (and future proof things). |
And after patching my fork into my environment and testing it seems to be working as expected. I now have logs where there were no logs before. |
Signed-off-by: vsoch <[email protected]>
This is an untested PR, but one I hope is fairly straightforward. I have a container whose program within it only outputs on the stderr. When streaming I am via the
Client.execute
method I am unable to capture these messages and log them.This PR aims to:
?
Would someone be able to give this a look over and test?