vendor/bundle/ruby/1.8/gems/grit-2.4.1/lib/grit/jruby.rb
def popen4(*argv)
      env = (argv.shift if argv[0].is_a?(Hash))  || {}
      opt = (argv.pop   if argv[-1].is_a?(Hash)) || {}

      # emulate :chdir option
      if opt[:chdir]
        previous_dir = Dir.pwd
        Dir.chdir(opt[:chdir])
      else
        previous_dir = nil
      end

      # emulate :env option
      if env.size > 0
        previous_env = ENV
        ENV.merge!(env)
      else
        previous_env = nil
      end

      pid, stdin, stdout, stderr = IO.popen4(*argv)
    ensure
      ENV.replace(previous_env) if previous_env
      Dir.chdir(previous_dir)   if previous_dir
    end
# Use JRuby's built in IO.popen4 but emulate the special spawn env
# and options arguments as best we can.
Use JRuby's built in IO.popen4 but emulate the special spawn env
and options arguments as best we can.
Use JRuby ' s built in IO . popen4 but emulate the special spawn env and options arguments as best we can .
def popen4(*argv)
      env = (argv.shift if argv[0].is_a?(Hash))  || {}
      opt = (argv.pop   if argv[-1].is_a?(Hash)) || {}
      if opt[:chdir]
        previous_dir = Dir.pwd
        Dir.chdir(opt[:chdir])
      else
        previous_dir = nil
      end
      if env.size > 0
        previous_env = ENV
        ENV.merge!(env)
      else
        previous_env = nil
      end
      pid, stdin, stdout, stderr = IO.popen4(*argv)
    ensure
      ENV.replace(previous_env) if previous_env
      Dir.chdir(previous_dir)   if previous_dir
    end
def popen4 ( * argv ) env = ( argv . shift if argv [ 0 ] . is_a? ( Hash ) ) || { } opt = ( argv . pop if argv [ - 1 ] . is_a? ( Hash ) ) || { } if opt [ :chdir ] previous_dir = Dir . pwd Dir . chdir ( opt [ :chdir ] ) else previous_dir = nil end if env . size > 0 previous_env = ENV ENV . merge! ( env ) else previous_env = nil end pid , stdin , stdout , stderr = IO . popen4 ( * argv ) ensure ENV . replace ( previous_env ) if previous_env Dir . chdir ( previous_dir ) if previous_dir end
Use JRuby's built in IO.popen4 but emulate the special spawn env
and options arguments as best we can.
Use JRuby ' s built in IO . popen4 but emulate the special spawn env and options arguments as best we can .
# emulate :chdir option # emulate :env option
argv