From 81971c33427debb40cfe32949931a7b0bd980e28 Mon Sep 17 00:00:00 2001 From: Jon Date: Sat, 13 Feb 2010 09:05:14 -0500 Subject: [PATCH] teach Albino to run on both Windows and *nix --- jekyll.gemspec | 3 --- lib/jekyll/albino.rb | 12 +++++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index b4d6b0c4..9632ae16 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -129,14 +129,12 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, [">= 1.3.1"]) s.add_runtime_dependency(%q, [">= 0.5.9"]) s.add_runtime_dependency(%q, [">= 1.1.1"]) - s.add_runtime_dependency(%q, [">= 0.9.6"]) else s.add_dependency(%q, [">= 4.2.1"]) s.add_dependency(%q, [">= 1.9.0"]) s.add_dependency(%q, [">= 1.3.1"]) s.add_dependency(%q, [">= 0.5.9"]) s.add_dependency(%q, [">= 1.1.1"]) - s.add_dependency(%q, [">= 0.9.6"]) end else s.add_dependency(%q, [">= 4.2.1"]) @@ -144,7 +142,6 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 1.3.1"]) s.add_dependency(%q, [">= 0.5.9"]) s.add_dependency(%q, [">= 1.1.1"]) - s.add_dependency(%q, [">= 0.9.6"]) end end diff --git a/lib/jekyll/albino.rb b/lib/jekyll/albino.rb index 2497cb6d..10d0ffb9 100644 --- a/lib/jekyll/albino.rb +++ b/lib/jekyll/albino.rb @@ -41,7 +41,6 @@ # Chris Wanstrath // chris@ozmm.org # GitHub // http://github.com # -require 'open4' class Albino @@bin = Rails.development? ? 'pygmentize' : '/usr/bin/pygmentize' rescue 'pygmentize' @@ -61,11 +60,10 @@ class Albino def execute(command) output = '' - Open4.popen4(command) do |pid, stdin, stdout, stderr| - stdin.puts @target - stdin.close - output = stdout.read.strip - [stdout, stderr].each { |io| io.close } + IO.popen(command, mode='r+') do |p| + p.write @target + p.close_write + output = p.read.strip end output end @@ -119,4 +117,4 @@ if $0 == __FILE__ assert_equal @syntaxer.colorize, Albino.colorize(__FILE__, :ruby) end end -end \ No newline at end of file +end