henry-container 0.1.51 → 0.1.52

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0825287f7439f75c6107577d3049a4585014aa5
4
- data.tar.gz: 54e2497554a157f5b6215af7fda9a0536248a964
3
+ metadata.gz: 3f66dab395d2dab8ba80055331ab0bf67f2a0652
4
+ data.tar.gz: aadb6d1338ddf6728b2fc752bb9b9e989b06b336
5
5
  SHA512:
6
- metadata.gz: a94b20404701519ff5fa206a101de49384f6d3d218b565f7c6f8aace5ba3e7594ef288787e3beac98ac9b0099d1ad69996780014b834c8a36ecf64175e7f7849
7
- data.tar.gz: 4739bbfa437a795bffdbbf105867cf302f646d9d2e7d73335b2b714dbf3e38b5e1bef2a6364ba1caf304cdcd23235d9f9752d439de9ef28ab25969724bc66396
6
+ metadata.gz: f2f6ed65900eee29d5a2b03e65cc0c1e7fb09b94663858d72f842d81b034a61280b4df4cb50b351f41f8d0185e74a4bc38b003d3243d98ca217d18d2d49fd541
7
+ data.tar.gz: 29f2482761ff07489a1fb6d522e237f0eb5a11601458d37563138f54200fe52ed89b2b1f6821be38b8ac40fb75cf57d4b23eee39abd92f0e274a0304d80c979d
@@ -3,7 +3,7 @@ module Henry
3
3
  class Container
4
4
 
5
5
  # Current Gem version
6
- VERSION = ENV['gem_version'] || '0.1.51'
6
+ VERSION = ENV['gem_version'] || '0.1.52'
7
7
 
8
8
  end
9
9
 
@@ -101,10 +101,23 @@ module Henry
101
101
  task.execution.code = 'ERROR'
102
102
  task.execution.message = 'The task execution exeeded the timeout.'
103
103
  ensure
104
+ self.kill_children(Process.pid)
105
+ end
106
+
107
+ # Kills children processes recursively.
108
+ #
109
+ # @params [Integer] pid the pid of the process to be killed.
110
+ def kill_children(pid)
104
111
  begin
105
- `ps o pid= --ppid #{Process.pid}`.scan(/\d+/).each do |pid|
112
+ children_pids = `ps o pid= --ppid #{pid}`.scan(/\d+/).collect(&:to_i)
113
+
114
+ return false if pids.count == 1
115
+
116
+ children_pids.each do |child_pid|
106
117
  begin
107
- Process.kill('KILL', pid.to_i)
118
+ Process.kill('KILL', child_pid)
119
+
120
+ self.kill_children(child_pid)
108
121
  rescue Errno::ESRCH
109
122
  end
110
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: henry-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.51
4
+ version: 0.1.52
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Decurnex