Cannot send SIGTERM to another process on Windows

This commit is contained in:
Nobuyoshi Nakada 2025-04-04 10:59:51 +09:00
parent 0251abca7f
commit d22e766042
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-04-04 12:12:51 +00:00

View File

@ -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" : ""}" puts "#{github_actions ? "::group::\e\[93m" : "\n"}Testing the #{gem} gem#{github_actions ? "\e\[m" : ""}"
print "[command]" if github_actions print "[command]" if github_actions
puts test_command puts test_command
pid = Process.spawn(test_command, "#{/mingw|mswin/ =~ RUBY_PLATFORM ? 'new_' : ''}pgroup": true) timeouts = {nil => first_timeout, INT: 30, TERM: 10, KILL: nil}
{nil => first_timeout, INT: 30, TERM: 10, KILL: nil}.each do |sig, sec| 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 if sig
puts "Sending #{sig} signal" puts "Sending #{sig} signal"
Process.kill("-#{sig}", pid) Process.kill("-#{sig}", pid)