ahoward / open4

open child process with handles on pid, stdin, stdout, and stderr: manage child processes and their io handles easily.
Other
194 stars 27 forks source link

JRuby + open4: 'fork is not available on this platform' #21

Open astrostl opened 11 years ago

astrostl commented 11 years ago

I was trying to make a jgem-based RPM using JRuby + https://github.com/jordansissel/fpm , and ran into this error. FPM has their own issue for it at https://github.com/jordansissel/fpm/issues/268 . Would there be any reasonable way for open4 to navigate around JRuby's (the JVM's) fork limitation?

nandosola commented 11 years ago

Same thing happens with Vlad (The Deployer):

coruscant:fileserver nando$ REMOTE_IP=192.168.42.166 rake vlad:setup --trace
** Invoke vlad:setup (first_time)
** Execute vlad:setup
** Invoke vlad:setup_app (first_time)
** Execute vlad:setup_app
ssh deployer@192.168.42.166 'mkdir -p /var/apps/trantor-fileserver /var/apps/trantor-fileserver/releases /var/apps/t
rantor-fileserver/shared /var/apps/trantor-fileserver/scm /var/apps/trantor-fileserver/shared/log /var/apps/trantor-
fileserver/shared/system /var/apps/trantor-fileserver/shared/pids'
rake aborted!
fork is not available on this platform
org/jruby/RubyKernel.java:1749:in `fork'
/Users/nando/.rbenv/versions/jruby-1.7.2/lib/ruby/gems/shared/gems/open4-1.3.0/lib/open4.rb:58:in `do_popen'
/Users/nando/.rbenv/versions/jruby-1.7.2/lib/ruby/gems/shared/gems/open4-1.3.0/lib/open4.rb:30:in `popen4'
/Users/nando/.rbenv/versions/jruby-1.7.2/lib/ruby/gems/shared/gems/rake-remote_task-2.2.1/lib/rake/remote_task.rb:19
1:in `run'
(eval):1:in `run'
/Users/nando/.rbenv/versions/jruby-1.7.2/lib/ruby/gems/shared/gems/vlad-2.4.1/lib/vlad/core.rb:58:in `(root)'
org/jruby/RubyProc.java:249:in `call'
/Users/nando/.rbenv/versions/jruby-1.7.2/lib/ruby/gems/shared/gems/rake-remote_task-2.2.1/lib/rake/remote_task.rb:68
7:in `execute'
Tasks: TOP => vlad:setup_app

open4 is a runtime dependency of rake-remote_task, which is required by vlad

nandosola commented 11 years ago

A possible solution is detailed here:

https://github.com/seattlerb/rake-remote_task/pull/11

r4um commented 11 years ago

spoon looks like a good alternative to use instead of fork directly.