Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Make Jekyll play nice with Windows again post Albino + posix-spawn refactor
diff --git a/lib/albino.rb b/lib/albino.rb
index 387c8e9..b77d55e 100644
--- a/lib/albino.rb
+++ b/lib/albino.rb
@@ -1,4 +1,5 @@
require 'posix-spawn'
+require 'rbconfig'
# Wrapper for the Pygments command line tool, pygmentize.
@@ -84,11 +85,21 @@ class Albino
proc_options[:timeout] = options.delete(:timeout) || self.class.timeout_threshold
command = convert_options(options)
-*(command + [proc_options.merge(:input => write_target)]))
+ if RbConfig::CONFIG['host_os'] =~ /(mingw|mswin)/
+ output = ''
+ IO.popen(command, mode='r+') do |p|
+ p.write @target
+ p.close_write
+ output =
+ end
+ output
+ else
+*(command + [proc_options.merge(:input => write_target)]))
+ end
def colorize(options = {})
- out = execute(options).out
+ out = RbConfig::CONFIG['host_os'] =~ /(mingw|mswin)/ ? execute(options) : execute(options).out
# markdown requires block elements on their own line
out.sub!(%r{</pre></div>\Z}, "</pre>\n</div>")
Copy link

hickford commented May 9, 2012

Stupid question, how do I apply the patch?

Copy link

madhur commented May 10, 2012 via email

Copy link

I reported the bug that this patch fixes in Albino github/albino#14

Hopefully the patch will be accepted

Copy link

@madhur thanks for posting this up here, patch worked perfectly. Shame that albino seems to be abandoned though.

Copy link

thanks,but if i have not albino-1.3.3,。。。

Copy link

thanks,but if i have not albino-1.3.3,。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment