The old code was checking stdio redirection in a loop.
This didn't make sense. The pattern is better expressed
as a context manager IMO, so this commit refactors it
to be one.
Details
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHG3cbbfd0bfc17: hook: move stdio redirection to context manager
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Comment Actions
This commit isn't strictly required. I performed this refactoring anticipating needing to add sys.std* fixups as part of this function. But it turns out that the SSH protocol server handles I/O redirection via a different mechanism. There actually appear to be redundant mechanisms for intercepting stdio as part of the wire protocol. This is potentially an area that we could clean up. But I'm not inclined to do so at this time.
Anyway, I feel the cleanup here improves readability, so I sent it along.