The problem was from changing the impl.iter_process_parents to a generator rather than a plan old iterator. The body of generators isn't evaluated until the first time their next method is called, so the check here:
The fix is to just wrap the inner generator - so the detect_proc function is called in the expected place, and if it passes then the called generator is returned and equivalant to the current generator
Fixes https://github.com/sarugaku/shellingham/issues/78
The problem was from changing the
impl.iter_process_parents
to a generator rather than a plan old iterator. The body of generators isn't evaluated until the first time theirnext
method is called, so the check here:https://github.com/sarugaku/shellingham/blob/bf9f580f7b3f0ff2254730462ed7b50898dd1aa8/src/shellingham/posix/__init__.py#L46-L47
is incorrect because the environment error is raised here instead:
https://github.com/sarugaku/shellingham/blob/bf9f580f7b3f0ff2254730462ed7b50898dd1aa8/src/shellingham/posix/__init__.py#L108
or, when the generator is unpacked.
The fix is to just wrap the inner generator - so the
detect_proc
function is called in the expected place, and if it passes then the called generator is returned and equivalant to the current generator