Skip to content

Commit

Permalink
we don't want zombies running around
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Mar 9, 2010
1 parent 580d0ef commit 94eaea6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/rocco.rb
Expand Up @@ -142,15 +142,17 @@ def highlight(blocks)
# 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
Expand Down

0 comments on commit 94eaea6

Please sign in to comment.