Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
[JLT-170460] Chef: sometimes stop_processes() utility method timeouts
Browse files Browse the repository at this point in the history
* Added check to omit the pgrep process which cause the method stop_processes() to timeout
  • Loading branch information
dynapozieblo committed Nov 18, 2016
1 parent ecfb9e9 commit ed230c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/process_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
require 'open-uri'
require 'socket'
require 'timeout'
require 'English' # $CHILD_STATUS.pid

module Dynatrace
# Helper methods related to handling system processes
Expand Down Expand Up @@ -69,12 +70,13 @@ def self.find_pids(pattern, user, platform_family)
# end
# this part working and fixes code above
pid_str = `#{search_processes_cmd}`
pgrep_pid = $CHILD_STATUS.pid
unless pid_str.empty?
text = []
text << pid_str.lines.map(&:chomp)
text.each do |x|
x.each do |y|
pids << y.to_i
pids << y.to_i unless y.to_i == pgrep_pid
end
end
end
Expand Down

0 comments on commit ed230c8

Please sign in to comment.