alexch / rerun

Restarts an app when the filesystem changes. Uses growl and FSEventStream if on OS X.
Other
981 stars 79 forks source link

JRuby support #119

Open brauliobo opened 6 years ago

brauliobo commented 6 years ago
~/P/retirement ❯❯❯ rerun --dir config --pattern '{*,.*}' bin/daemon                                                                                     master ✱
19:21:48 [rerun] Retirement launched
NotImplementedError: fork is not available on this platform
          fork at org/jruby/RubyKernel.java:1736
         start at /home/braulio/.rvm/gems/jruby-9.1.13.0/gems/rerun-0.11.0/lib/rerun/runner.rb:152
  keep_running at /home/braulio/.rvm/gems/jruby-9.1.13.0/gems/rerun-0.11.0/lib/rerun/runner.rb:9
        <main> at /home/braulio/.rvm/gems/jruby-9.1.13.0/gems/rerun-0.11.0/bin/rerun:12
          load at org/jruby/RubyKernel.java:973
        <eval> at /home/braulio/.rvm/gems/jruby-9.1.13.0/bin/rerun:1
          eval at org/jruby/RubyKernel.java:994
        <main> at /home/braulio/.rvm/gems/jruby-9.1.13.0/bin/jruby_executable_hooks:15
alexch commented 6 years ago

I don't know much about JRuby, but if it doesn't support fork then I doubt there's much rerun can do. Fortunately, rerun is independent from your own JRuby app; you can install multiple versions of ruby on the same system and use one for rerun and the other for your own app(s). I see you're using rvm so I bet there's a way to ask it to run rerun with an MRI Ruby, something like

rvm 2.3.2 do rerun --dir config --pattern '{*,.*}' bin/daemon

(Assuming you have a ruby 2.3.2 in your rvm list.)

Please let me know how this goes.

brauliobo commented 6 years ago

Why a fork is needed to execute a separate process? Isn't a thread with Process.wait enough?

alexch commented 6 years ago

Oh wait, v0.11 was before we switched from fork/exec to spawn. Can you try with the newly-released v0,12?