Skip to content
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

Allow specifying stdout to Popen #180

Merged
merged 5 commits into from
Jun 17, 2019
Merged

Allow specifying stdout to Popen #180

merged 5 commits into from
Jun 17, 2019

Conversation

s0undt3ch
Copy link
Contributor

No description provided.

@s0undt3ch
Copy link
Contributor Author

The reason behind this change is that on a particular session, we need access to the output, even if the command failed, for CI reporting reasons.

@theacodes
Copy link
Collaborator

theacodes commented Apr 23, 2019

Can you show me an example of when you'd use this and why the existing mechanisms aren't giving you the output you expect?

@mostealth
Copy link
Contributor

When running in CI you might want to save pylint output to file (to be later parsed). pylint does not support outputting to file hence the only solution I found was to monkey patch subprocess.Popen so that I inject my own stdout/stderr file before calling session.run

@s0undt3ch
Copy link
Contributor Author

What @mostealth said, that's our exact same scenario and why I created this PR.

This solution in use on our repo can be seen here

@theacodes
Copy link
Collaborator

That seems like a great reason. I had a comment about covering some edge cases, but I'm happy to merge this once we get that sorted. :)

@s0undt3ch
Copy link
Contributor Author

Rebased and added two new tests based on the comments provided.

@theacodes
Copy link
Collaborator

Okay, I made silent and stdout mutually exclusive since silent doesn't have an effect if stdout is passed.

Does this still look good to you, @s0undt3ch? Also, it should be technically possible to override stderr now. Do you mind adding a test for that?

@s0undt3ch
Copy link
Contributor Author

Added tests for custom stderr

@theacodes theacodes merged commit 096886a into wntrblm:master Jun 17, 2019
@theacodes
Copy link
Collaborator

Thank you, @s0undt3ch!

@s0undt3ch s0undt3ch deleted the features/stds branch June 17, 2019 16:54
@s0undt3ch
Copy link
Contributor Author

Anytime!

theacodes pushed a commit that referenced this pull request Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants