Using block syntax of popen4 to ensure that subprocesses are properly disposed of.

This fixes resource unavailable errors when jekyll is run with '--auto --pygments':
  Liquid error: Resource temporarily unavailable – fork(2)
  fork: Resource temporarily unavailable
This commit is contained in:
Elijah Miller 2009-02-07 13:20:00 -05:00 committed by Tom Preston-Werner
parent 82d96448b5
commit 2135a53897
1 changed files with 7 additions and 4 deletions

View File

@ -60,10 +60,13 @@ class Albino
end
def execute(command)
pid, stdin, stdout, stderr = Open4.popen4(command)
stdin.puts @target
stdin.close
stdout.read.strip
output = ''
Open4.popen4(command) do |pid, stdin, stdout, stderr|
stdin.puts @target
stdin.close
output = stdout.read.strip
end
output
end
def colorize(options = {})