sstephenson / bats

Bash Automated Testing System
MIT License
7.12k stars 518 forks source link

Bats script does not exit in some cases. #218

Open ghost opened 7 years ago

ghost commented 7 years ago

I'm using bats to automate the runs of some tests I've written in bash. What I'm doing in the bats file is only calling the bash script, e.g.

@test "Run test script." { bash ~/test.sh }

This was working fine until I made some changes to the test.sh (saved the test logs to a different directory owned by a different user). After the changes are made, the test.sh works fine and exits after completing the tasks however the test.bats doesn't exit and hangs after:

ok 1 Run test script.

I checked the running processes and found that test.sh is no longer running. However, a script "/usr/lib/bats/bats-format-tap-stream" in case of pretty formatting and "cat" in case of TAP is running. Killing that formatter kills the test.bats as well. Is there any way to explicitly exit the bats script in this situation?

xmik commented 7 years ago

Try if workaround from this comment helps: https://github.com/sstephenson/bats/issues/80#issuecomment-174101686