Is it possible to determine if the ruby implementation you are using supports forkwithout running a regular expression against RUBY_PLATFORM, which will expand as long as it calls Cthulhu ?
(Related question: Ruby - How do I know which system my program is running on?
Change . I tried Mark-Andre's suggestion. It does not work for jruby with the plug disabled by default:
192-168-1-7:~ agrimm$ jruby --1.9 -S jirb
irb(main):001:0> RUBY_VERSION
=> "1.9.2dev"
irb(main):002:0> Process.respond_to?(:fork)
=> true
irb(main):003:0> Process.fork
NotImplementedError: fork is unsafe and disabled by default on JRuby
Update : using the Marc-Andre link, this seems like a wiser voice than I dealt with this problem in terms of creating Ruby implementations and failed.
From the point of view of someone writing a ruby library, what would be the most complete spell would be the lack of a plug and seeing if this throws an exception?
source
share