Skip to content

Commit 234945c

Browse files
committed
troubleshooting: handle nil from wnohang flag
1 parent a256dbc commit 234945c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
kubernetes_template_rendering (0.2.1.pre.dc.5)
4+
kubernetes_template_rendering (0.2.1.pre.dc.6)
55
activesupport
66
invoca-utils
77
jsonnet

lib/kubernetes_template_rendering/template_directory_renderer.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,16 @@ def read_definitions(path)
6868
def wait_if_max_forked(child_pids)
6969
while child_pids.size >= MAX_FORKED_PROCESSES
7070
begin
71-
Process.waitpid # this is a race condition because 1 or more processes could exit before we get here
71+
pid, exit_status = Process.waitpid2 # this is a race condition because 1 or more processes could exit before we get here
72+
exit_status.success? or raise "Child process #{pid} failed"
7273
rescue SystemCallError # this will happen if they all exited before we called waitpid
7374
end
7475
child_pids.delete_if do |pid|
7576
begin
7677
_, exit_status = Process.waitpid2(pid, Process::WNOHANG)
77-
exit_status.success? or raise "Child process #{pid} failed"
78+
if exit_status
79+
exit_status.success? or raise "Child process #{pid} failed"
80+
end
7881
rescue Errno::ECHILD # No child processes
7982
true
8083
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module KubernetesTemplateRendering
4-
VERSION = "0.2.1.pre.dc.5"
4+
VERSION = "0.2.1.pre.dc.6"
55
end

0 commit comments

Comments
 (0)