Blogged by Ujihisa. Standard methods of programming and thoughts including Clojure, Vim, LLVM, Haskell, Ruby and Mathematics written by a Japanese programmer. github/ujihisa

Sunday, March 21, 2010

Spawn On JRuby

As the previous posts of this blog, ruby 1.9's Kernel.spawn is very useful. I ported it to ruby 1.8 partly. How about on JRuby?

Currently there are two ways of using spawn on JRuby, but both of them have problem.

fork + exec + spawn-for-legacy library

I made a wrapper library spawn-for-legacy which provides ruby 1.9 style spawn, using fork and exec.

If JRuby has fork and exec, you can use spawn-for-legacy. Unfortunatelly when you use fork on JRuby, you have to set a command line option to JRuby interpreter.

Followers