lib/henry/container.rb in henry-container-0.1.52 vs lib/henry/container.rb in henry-container-0.1.53

- old
+ new

@@ -101,30 +101,30 @@ task.execution.code = 'ERROR' task.execution.message = 'The task execution exeeded the timeout.' ensure self.kill_children(Process.pid) end + end - # Kills children processes recursively. - # - # @params [Integer] pid the pid of the process to be killed. - def kill_children(pid) - begin - children_pids = `ps o pid= --ppid #{pid}`.scan(/\d+/).collect(&:to_i) + # Kills children processes recursively. + # + # @params [Integer] pid the pid of the process to be killed. + def kill_children(pid) + begin + children_pids = `ps o pid= --ppid #{pid}`.scan(/\d+/).collect(&:to_i) - return false if pids.count == 1 + return false if pids.count == 1 - children_pids.each do |child_pid| - begin - Process.kill('KILL', child_pid) + children_pids.each do |child_pid| + begin + Process.kill('KILL', child_pid) - self.kill_children(child_pid) - rescue Errno::ESRCH - end + self.kill_children(child_pid) + rescue Errno::ESRCH end - rescue Errno::ENOENT - warn 'Can not cleanup this process children' - end + t g end + rescue Errno::ENOENT + warn 'Can not cleanup this process children' end end # Returns the input file path based on the given options. #