Skip to content

Conversation

@zocainViken
Copy link
Contributor

def __enter__(self):
    if self.disable:
        return self

    # Check if sys.stdout and sys.stderr have fileno method
    if not hasattr(self.sys.stdout, 'fileno') or not hasattr(self.sys.stderr, 'fileno'):
        return self  # Return the instance without making changes

def __exit__(self, *_):
    if self.disable:
        return

    # Check if sys.stdout and sys.stderr have fileno method
    if hasattr(self.sys.stdout, 'fileno') and hasattr(self.sys.stderr, 'fileno'):

@zocainViken
Copy link
Contributor Author

@abetlen abetlen merged commit ac35f68 into abetlen:main Dec 12, 2023
@abetlen
Copy link
Owner

abetlen commented Dec 12, 2023

@zocainViken thank you! Does this now resolve #872 ?

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

Successfully merging this pull request may close these issues.

2 participants