From 94eaea6339e0f76cbd24c20dd0b60945cf1795a1 Mon Sep 17 00:00:00 2001 From: Ryan Tomayko Date: Tue, 9 Mar 2010 09:16:53 -0800 Subject: [PATCH] we don't want zombies running around --- lib/rocco.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/rocco.rb b/lib/rocco.rb index 22f1f14..0cfdc31 100644 --- a/lib/rocco.rb +++ b/lib/rocco.rb @@ -142,15 +142,17 @@ class Rocco # then fork off a child process to write the input. code_html = nil open("|pygmentize -l ruby -f html", 'r+') do |fd| - fork { - fd.close_read - fd.write code_blocks.join("\n\n# DIVIDER\n\n") - fd.close_write - exit! - } + pid = + fork { + fd.close_read + fd.write code_blocks.join("\n\n# DIVIDER\n\n") + fd.close_write + exit! + } fd.close_write code_html = fd.read fd.close_read + Process.wait(pid) end # Do some post-processing on the pygments output to split things back