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

stdout redirect shouldn't set sys.stdout to None #2879

Closed
willmcgugan opened this issue Jul 2, 2023 · 4 comments
Closed

stdout redirect shouldn't set sys.stdout to None #2879

willmcgugan opened this issue Jul 2, 2023 · 4 comments
Assignees

Comments

@willmcgugan
Copy link
Collaborator

willmcgugan commented Jul 2, 2023

It looks as though the redirect_stdout(None) (and stderr version) sets sys.stdout to None.

Nothing has broken up until now, which suggest that the print function treats None as a special case. However, this won't be the case where sys.stdout is expected to contain a file like object.

This is the root cause of #2877 and #2878

The redirected stdout should go to dev/null. See os.devnull

alexiri added a commit to alexiri/textual that referenced this issue Jul 2, 2023
alexiri added a commit to alexiri/textual that referenced this issue Jul 2, 2023
alexiri added a commit to alexiri/textual that referenced this issue Jul 2, 2023
willmcgugan pushed a commit that referenced this issue Jul 2, 2023
* Redirect output to devnull

Fixes #2877, #2878 and #2879.

* Rename file handle

* Reformat
@rodrigogiraoserrao
Copy link
Contributor

Closed with #2880.

@github-actions
Copy link

github-actions bot commented Jul 5, 2023

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

@alexiri
Copy link
Contributor

alexiri commented Jul 5, 2023

@willmcgugan This fix seems to be missing from the changelog of 0.29.0, but it's included, right?

@rodrigogiraoserrao
Copy link
Contributor

This fix seems to be missing from the changelog of 0.29.0, but it's included, right?

Wooops, when we reviewed your PR #2880 we should've asked you to add the fix entry to the changelog, but we forgot and we didn't add it later.
Your fix should be in 0.29.0 regardless of this omission from the changelog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants