bash_test: handle race condition.

Other tests may delete Bash files (e.g. `shcmd.sh`) while tests are
ongoing so ensure this doesn't cause a test failure.
This commit is contained in:
Mike McQuaid 2016-12-03 15:59:05 +00:00
parent bc9d3afd6e
commit 3f6d31dee1

View File

@ -2,6 +2,7 @@ require "testing_env"
class BashTests < Homebrew::TestCase class BashTests < Homebrew::TestCase
def assert_valid_bash_syntax(file) def assert_valid_bash_syntax(file)
return unless file.exist?
output = Utils.popen_read("/bin/bash -n #{file} 2>&1") output = Utils.popen_read("/bin/bash -n #{file} 2>&1")
assert $?.success?, output assert $?.success?, output
end end