Skip to content

Commit 443b17a

Browse files
YO4hsbt
authored andcommitted
test-bundled-gems property fails if timed out on Windows
Use spawn with array to make SIGINT working effectively on Windows
1 parent 1f542c1 commit 443b17a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tool/test-bundled-gems.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
next if bundled_gems&.none? {|pat| File.fnmatch?(pat, gem)}
3434
next unless File.directory?("#{gem_dir}/src/#{gem}/test")
3535

36-
test_command = "#{ruby} -C #{gem_dir}/src/#{gem} #{rake} test"
36+
test_command = [ruby, "-C", "#{gem_dir}/src/#{gem}", rake, "test"]
3737
first_timeout = 600 # 10min
3838

3939
toplib = gem
@@ -61,7 +61,7 @@
6161
rbs_skip_tests << File.join(__dir__, "/rbs_skip_tests_windows")
6262
end
6363

64-
test_command << " stdlib_test validate RBS_SKIP_TESTS=#{rbs_skip_tests.join(File::PATH_SEPARATOR)} SKIP_RBS_VALIDATION=true"
64+
test_command.concat %W[stdlib_test validate RBS_SKIP_TESTS=#{rbs_skip_tests.join(File::PATH_SEPARATOR)} SKIP_RBS_VALIDATION=true]
6565
first_timeout *= 3
6666

6767
when "debug"
@@ -71,7 +71,7 @@
7171
load_path = true
7272

7373
when "test-unit"
74-
test_command = "#{ruby} -C #{gem_dir}/src/#{gem} test/run.rb"
74+
test_command = [ruby, "-C", "#{gem_dir}/src/#{gem}", "test/run.rb"]
7575

7676
when "win32ole"
7777
next unless /mswin|mingw/ =~ RUBY_PLATFORM
@@ -89,18 +89,17 @@
8989
# 93(bright yellow) is copied from .github/workflows/mingw.yml
9090
puts "#{github_actions ? "::group::\e\[93m" : "\n"}Testing the #{gem} gem#{github_actions ? "\e\[m" : ""}"
9191
print "[command]" if github_actions
92-
puts test_command
92+
p test_command
9393
timeouts = {nil => first_timeout, INT: 30, TERM: 10, KILL: nil}
9494
if /mingw|mswin/ =~ RUBY_PLATFORM
9595
timeouts.delete(:TERM) # Inner process signal on Windows
96-
timeouts.delete(:INT) # root process will be terminated too
9796
group = :new_pgroup
9897
pg = ""
9998
else
10099
group = :pgroup
101100
pg = "-"
102101
end
103-
pid = Process.spawn(test_command, group => true)
102+
pid = Process.spawn(*test_command, group => true)
104103
timeouts.each do |sig, sec|
105104
if sig
106105
puts "Sending #{sig} signal"

0 commit comments

Comments
 (0)