From cec45aedb5ce7cf9f263421712ad5abcf6404380 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 4 Apr 2025 15:21:11 +0900 Subject: [PATCH] Cannot send signal to process group on Windows --- tool/test-bundled-gems.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb index 133d603c42..819f466573 100644 --- a/tool/test-bundled-gems.rb +++ b/tool/test-bundled-gems.rb @@ -83,14 +83,16 @@ File.foreach("#{gem_dir}/bundled_gems") do |line| if /mingw|mswin/ =~ RUBY_PLATFORM timeouts.delete(:TERM) # Inner process signal on Windows group = :new_pgroup + pg = "" else group = :pgroup + pg = "-" end pid = Process.spawn(test_command, group => true) timeouts.each do |sig, sec| if sig puts "Sending #{sig} signal" - Process.kill("-#{sig}", pid) + Process.kill("#{pg}#{sig}", pid) end begin break Timeout.timeout(sec) {Process.wait(pid)} @@ -98,7 +100,7 @@ File.foreach("#{gem_dir}/bundled_gems") do |line| end rescue Interrupt exit_code = Signal.list["INT"] - Process.kill("-KILL", pid) + Process.kill("#{pg}KILL", pid) Process.wait(pid) break end