Skip to content

Commit

Permalink
Summary: Reverting addition of posix-spawn for JRuby
Browse files Browse the repository at this point in the history
The posix-spawn gem does work under JRuby (finally) but it's still
problematic at best. Its support for JRuby is mostly just for
conveinence (ex. tools like foreman) but it still uses a C-extension
under the hood.

While C-extensions work under JRuby, they're generally not
recommended unless you just don't have any other choice.

All that said, I'm actually reverting this primarily because Travis-CI
doesn't support C-extensions under JRuby and the builds won't pass with
this gem included.

CI for JRuby on our pull requests seems more important than the gains
we get from fork+exec, but hopefully can find a better solution to this
anyway.
  • Loading branch information
Brandon Black committed Oct 12, 2012
1 parent 966b10c commit 0a6c101
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Expand Up @@ -18,8 +18,6 @@ group :development, :test do
gem "ci_reporter"
gem "ruby-prof" unless RUBY_PLATFORM =~ /java/
gem "rake-compiler"
# posix-spawn: XCode 4.4 - brew install apple-gcc42 && export CC=/usr/local/bin/gcc-4.2 && bundle install
gem "posix-spawn" if RUBY_PLATFORM =~ /java/

# Java
platforms :jruby do
Expand Down
16 changes: 5 additions & 11 deletions test/tools/mongo_config.rb
Expand Up @@ -2,7 +2,6 @@
require 'socket'
require 'fileutils'
require 'mongo'
require 'posix/spawn' if RUBY_PLATFORM == 'java'

$debug_level = 2
STDOUT.sync = true
Expand Down Expand Up @@ -130,16 +129,11 @@ def initialize(cmd = nil)
def start(verifies = 0)
return @pid if running?
begin
if RUBY_PLATFORM == 'java'
@pid = POSIX::Spawn::spawn(@cmd, [:in, :out, :err] => :close)
else
@pid = fork do
STDIN.reopen '/dev/null'
STDOUT.reopen '/dev/null', 'a'
STDERR.reopen STDOUT
exec cmd
end
#@pid = Process.spawn(@cmd, [:in, :out, :err] => :close)
@pid = fork do
STDIN.reopen '/dev/null'
STDOUT.reopen '/dev/null', 'a'
STDERR.reopen STDOUT
exec cmd
end
verify(verifies) if verifies > 0
@pid
Expand Down

0 comments on commit 0a6c101

Please sign in to comment.