Fix bug that leaves fds in select after EOF received #154
This fixes an issue I ran into where ssh-agent pipes were left open after we received EOF. I reported it as a fabric issue here:
This breaks out of the select loop and closes pipes when select returns an fd that is ready with 0 read (EOF).
Testing this via Fabric + ssh agent forwarding as discussed in the Fabric + upstream tickets, e.g.:
from fabric.api import * def foo(): for _ in range(10): run("git remote show origin") # my homedir is a git repo run("sleep 30") # for time to lsof/etc locally
invoked as e.g.:
and then in another terminal doing:
(too lazy to use os.getpid I guess :D)
Sure enough it goes up by 2 every time Fab runs a new git command, and never recedes.
About to try this workflow with the patch applied.
Beautiful, with patch applied it's typically 0 with occasional bumps to 2 as the command actually runs (GH is a tad slow today :D) Thanks for this! Also verified test suites pass. Will add changelog notice and push to the 1.10 branch, then probably cut a 1.10.1 release with this + another bugfix.