Permalink
Browse files

remove all the grit jruby hacks in favor of updated posix-spawn

  • Loading branch information...
1 parent 12c9874 commit 0822ea6aeef2fc0807688c5b7f0161c1c0577655 @tmm1 tmm1 committed Jun 8, 2011
Showing with 0 additions and 50 deletions.
  1. +0 −5 lib/grit.rb
  2. +0 −45 lib/grit/jruby.rb
View
@@ -48,11 +48,6 @@
require 'grit/blame'
require 'grit/merge'
-# platform specific requires
-if defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/
- require 'grit/jruby'
-end
-
module Grit
VERSION = '2.4.1'
View
@@ -1,45 +0,0 @@
-require 'grit/process'
-
-module Grit
- # Override the Grit::Process class's popen4 and waitpid methods to work around
- # various quirks in JRuby.
- class Process
- # 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)) || {}
-
- # 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
-
- # JRuby always raises ECHILD on pids returned from its IO.popen4 method
- # for some reason. Return a fake Process::Status object.
- FakeStatus = Struct.new(:pid, :exitstatus, :success?, :fake?)
- def waitpid(pid)
- ::Process::waitpid(pid)
- $?
- rescue Errno::ECHILD
- FakeStatus.new(pid, 0, true, true)
- end
- end
-end

0 comments on commit 0822ea6

Please sign in to comment.