Skip to content

Commit

Permalink
Switch to popen3 on Windows (mswin and mingw).
Browse files Browse the repository at this point in the history
Skip cygwin for now because that tries to emulate a Posix environment. If someone running on cygwin encounters a problem, we can add it to the bunch.

Should address #171.
  • Loading branch information
Jay Feldblum committed May 13, 2014
1 parent e5836b6 commit b968cd9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/librarian/posix.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
require "open3"
require "rbconfig"

require "librarian/error"

module Librarian
module Posix

module Platform
extend self

def win?
host_os = RbConfig::CONFIG["host_os"].dup.freeze
host_os =~ /mswin|mingw/
end
end

class << self

# Cross-platform way of finding an executable in the $PATH.
Expand Down Expand Up @@ -119,7 +129,9 @@ def run_spawn!(command, options = { })
[i, o, e].flatten(1).each{|io| io.close unless io.closed?}
end

if defined?(JRuby) # built with jruby-1.7.9 in mind
# jruby-1.7.9 can't fork and doesn't have a decent spawn
# windows can't fork and doesn't have a decent spawn
if defined?(JRuby) || Platform.win?

alias_method :run!, :run_popen3!

Expand Down

0 comments on commit b968cd9

Please sign in to comment.