bskinn / stdio-mgr

Context manager for mocking/wrapping stdin/stdout/stderr
MIT License
14 stars 4 forks source link

How to handle repeated stream closure in various circumstances? #66

Open bskinn opened 5 years ago

bskinn commented 5 years ago

With #53, #64 et al. allowing instantiation of StdioManager objects with a useful lifetime before and after use as a context manager, as well as independent of a managed context, the question arises as to what the behavior should be when a given stream in the internal tuple is .close()d more than once.

At this point, I believe a repeated .close() on a stream will raise ValueError? In some situations this is probably desired; but in others it might not be.

Or, for consistency, the behavior should perhaps always be the same.

This is loosely related to #42, in that the exception behavior is more a part of the API than not.