-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bats waits for bg processes in setup_file
even when FD3 is closed
#530
Comments
I did not investigate In any case the documentation should be updated accordingly. |
I gave it a try to address the hanging bg process with the pointers above, on top of latest master. FYI this is what I tried: jbriales@bc22c13 |
Follow-up of the above: Not sure why (
for fd in $(ls /proc/$$/fd/); do
[ $fd -gt 2 ] && exec {fd}<&-
done
sleep 2s &>/dev/null &
) On closer inspection, it seems this minimal set of FDs to close unblocks the bats process for bg processes inside sleep 2s &>/dev/null 3>&- 4>&- 63>&- & I.e. it seems for some reason I'm not aware of FD63 is also set for |
I already had a short look and could reproduce the issue. I noticed that the Those issues with unpredictable pipe duplicating FD numbers are exactly why I introduced this function. |
Just to wrap up what was happening: The stdout/err output from |
I'm following the indications in https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs and that seems to work when bg processes like
sleep 5s 3>- &
are launched from the test body or the (per-test)setup
function. But when launched from the (per-file)setup_file
function,sleep 5s 3>- &
is still blocking the bats execution after all tests are done.To reproduce:
Is this a known issue? I have seen very recent work around this topic in #525 but not sure if that will apply to this particular issue.
Environment:
The text was updated successfully, but these errors were encountered: