From d22e7660427e1e9929e8444135199b5c3e731246 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 4 Apr 2025 10:59:51 +0900 Subject: [PATCH] Cannot send `SIGTERM` to another process on Windows --- tool/test-bundled-gems.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb index 535d101d48..133d603c42 100644 --- a/tool/test-bundled-gems.rb +++ b/tool/test-bundled-gems.rb @@ -79,8 +79,15 @@ File.foreach("#{gem_dir}/bundled_gems") do |line| puts "#{github_actions ? "::group::\e\[93m" : "\n"}Testing the #{gem} gem#{github_actions ? "\e\[m" : ""}" print "[command]" if github_actions puts test_command - pid = Process.spawn(test_command, "#{/mingw|mswin/ =~ RUBY_PLATFORM ? 'new_' : ''}pgroup": true) - {nil => first_timeout, INT: 30, TERM: 10, KILL: nil}.each do |sig, sec| + timeouts = {nil => first_timeout, INT: 30, TERM: 10, KILL: nil} + if /mingw|mswin/ =~ RUBY_PLATFORM + timeouts.delete(:TERM) # Inner process signal on Windows + group = :new_pgroup + else + group = :pgroup + end + pid = Process.spawn(test_command, group => true) + timeouts.each do |sig, sec| if sig puts "Sending #{sig} signal" Process.kill("-#{sig}", pid)