henry-container 0.1.51 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/henry/container/version.rb +1 -1
- data/lib/henry/container.rb +15 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f66dab395d2dab8ba80055331ab0bf67f2a0652
|
4
|
+
data.tar.gz: aadb6d1338ddf6728b2fc752bb9b9e989b06b336
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2f6ed65900eee29d5a2b03e65cc0c1e7fb09b94663858d72f842d81b034a61280b4df4cb50b351f41f8d0185e74a4bc38b003d3243d98ca217d18d2d49fd541
|
7
|
+
data.tar.gz: 29f2482761ff07489a1fb6d522e237f0eb5a11601458d37563138f54200fe52ed89b2b1f6821be38b8ac40fb75cf57d4b23eee39abd92f0e274a0304d80c979d
|
data/lib/henry/container.rb
CHANGED
@@ -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 #{
|
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',
|
118
|
+
Process.kill('KILL', child_pid)
|
119
|
+
|
120
|
+
self.kill_children(child_pid)
|
108
121
|
rescue Errno::ESRCH
|
109
122
|
end
|
110
123
|
end
|