Closed zenazn closed 10 years ago
@ebroder, @ab — thoughts?
This is semantically "only close the file descriptor if we created it", right? If so, LGTM
:+1:
Actually the last version was trying to be a bit too magic and didn't quite cover everything (although arguably the PIPE case is the most important). Could you guys have another look?
LGTM!
This commit reverts 5ad3c3c9f787177b9313605ef05e1b6511224b69 and fixes the bug it was originally attempting to fix.
As of 5ad3c3c9f787177b9313605ef05e1b6511224b69, we dup IOs and file descriptors passed to Subprocess. This was to work around an issue where Subprocess would close files passed to it. However, the fact that Subprocess closed these files was the actual bug, and the dup'ing produced all kinds of undesirable behavior.
This change reverts the dup'ing behavior, but instead fixes the bug where Subprocess would close file descriptors you passed it, making the dup'ing behavior unnecessary in the first place.