mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
tests: Windows: run commands through explicit bash & temp shell script
Makes some of the commands work on Windows where system is cmd.exe
This commit is contained in:
parent
f681458bfc
commit
b0bbcc7a87
@ -324,7 +324,7 @@ class SimpleTest
|
|||||||
puts "COMMAND #{command}" if ENV['DEBUG']
|
puts "COMMAND #{command}" if ENV['DEBUG']
|
||||||
|
|
||||||
exit_code = 0
|
exit_code = 0
|
||||||
if !system(command)
|
if !run_bash command
|
||||||
exit_code = $? >> 8
|
exit_code = $? >> 8
|
||||||
self.error "system command failed: #{command} (#{exit_code})" if options[:exit_code] != exit_code
|
self.error "system command failed: #{command} (#{exit_code})" if options[:exit_code] != exit_code
|
||||||
end
|
end
|
||||||
|
@ -65,7 +65,10 @@ class Test
|
|||||||
command << " >/dev/null 2>/dev/null " unless (/>/.match(command))
|
command << " >/dev/null 2>/dev/null " unless (/>/.match(command))
|
||||||
|
|
||||||
puts "COMMAND #{command}" if ENV['DEBUG']
|
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
|
end
|
||||||
|
|
||||||
def tmp_name_prefix
|
def tmp_name_prefix
|
||||||
|
@ -51,3 +51,15 @@ else
|
|||||||
`md5sum #{name}`.chomp.gsub(/\s+.*/, "")
|
`md5sum #{name}`.chomp.gsub(/\s+.*/, "")
|
||||||
end
|
end
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user