diff --git a/lib/gitlab/sidekiq_signals.rb b/lib/gitlab/sidekiq_signals.rb index b704ee9a0a9d991eb7386dcf33995e1d12457dad..82462544d07b1191aa5b7d7079b76dc72702f04f 100644 --- a/lib/gitlab/sidekiq_signals.rb +++ b/lib/gitlab/sidekiq_signals.rb @@ -35,8 +35,11 @@ module Gitlab # signals from outside the process group, but that isn't fatal. def self.blindly_signal_pgroup!(signal) old_trap = trap(signal, 'IGNORE') - Process.kill(signal, "-#{Process.getpgrp}") - trap(signal, old_trap) + begin + Process.kill(signal, 0) + ensure + trap(signal, old_trap) + end end end end diff --git a/spec/lib/gitlab/sidekiq_signals_spec.rb b/spec/lib/gitlab/sidekiq_signals_spec.rb index 4483224f49d00c03673b7f72a794371f3734738f..77ecd1840d20469be8cee65c4b4b2f5c775d0224 100644 --- a/spec/lib/gitlab/sidekiq_signals_spec.rb +++ b/spec/lib/gitlab/sidekiq_signals_spec.rb @@ -44,7 +44,7 @@ describe Gitlab::SidekiqSignals do expect(Process) .to receive(:kill) - .with(signal, "-#{Process.pid}") + .with(signal, 0) .ordered expect(described_class)