Skip to content

Commit cec45ae

Browse files
committed
Cannot send signal to process group on Windows
1 parent d22e766 commit cec45ae

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tool/test-bundled-gems.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,24 @@
8383
if /mingw|mswin/ =~ RUBY_PLATFORM
8484
timeouts.delete(:TERM) # Inner process signal on Windows
8585
group = :new_pgroup
86+
pg = ""
8687
else
8788
group = :pgroup
89+
pg = "-"
8890
end
8991
pid = Process.spawn(test_command, group => true)
9092
timeouts.each do |sig, sec|
9193
if sig
9294
puts "Sending #{sig} signal"
93-
Process.kill("-#{sig}", pid)
95+
Process.kill("#{pg}#{sig}", pid)
9496
end
9597
begin
9698
break Timeout.timeout(sec) {Process.wait(pid)}
9799
rescue Timeout::Error
98100
end
99101
rescue Interrupt
100102
exit_code = Signal.list["INT"]
101-
Process.kill("-KILL", pid)
103+
Process.kill("#{pg}KILL", pid)
102104
Process.wait(pid)
103105
break
104106
end

0 commit comments

Comments
 (0)