diff --git a/tests/test.d/simple_test.rb b/tests/test.d/simple_test.rb index 3980ce7a6..fbd8834fd 100644 --- a/tests/test.d/simple_test.rb +++ b/tests/test.d/simple_test.rb @@ -324,7 +324,7 @@ class SimpleTest puts "COMMAND #{command}" if ENV['DEBUG'] exit_code = 0 - if !system(command) + if !run_bash command exit_code = $? >> 8 self.error "system command failed: #{command} (#{exit_code})" if options[:exit_code] != exit_code end diff --git a/tests/test.d/test.rb b/tests/test.d/test.rb index fa7290b18..bc165e051 100644 --- a/tests/test.d/test.rb +++ b/tests/test.d/test.rb @@ -65,7 +65,10 @@ class Test command << " >/dev/null 2>/dev/null " unless (/>/.match(command)) puts "COMMAND #{command}" if ENV['DEBUG'] - error "system command failed: #{command} (" + ($? >> 8).to_s + ")" if !system(command) && ((arg.size == 0) || ((arg[0] << 8) != $?)) + + result = run_bash command + + error "system command failed: #{command} (" + ($? >> 8).to_s + ")" if !result && ((arg.size == 0) || ((arg[0] << 8) != $?)) end def tmp_name_prefix diff --git a/tests/test.d/util.rb b/tests/test.d/util.rb index d227e5c49..aa90da562 100644 --- a/tests/test.d/util.rb +++ b/tests/test.d/util.rb @@ -51,3 +51,15 @@ else `md5sum #{name}`.chomp.gsub(/\s+.*/, "") end end + +def run_bash command + return system command if !$is_windows + + cmd_file = Tempfile.new + cmd_file.write command + cmd_file.close + + FileUtils.chmod 0700, cmd_file.path + + system "bash -c #{cmd_file.path}" +end