Issue #2619 has been updated by Hongli Lai.


#fork is defined in all versions of MRI on all platforms, even on platforms where it's not supported. It's just that calling #fork will raise NotImplementedError. Consider this snippet from process.c:

  #if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
  ...
  static VALUE
  rb_f_fork(VALUE obj)
  {
     ...fork code here...
  }
  #else
  #define rb_f_fork rb_f_notimplement
  #endif
  
  ...
  
  void
  Init_process(void)
  {
      rb_define_virtual_variable("$?", rb_last_status_get, 0);
      rb_define_virtual_variable("$$", get_pid, 0);
      rb_define_global_function("exec", rb_f_exec, -1);
      rb_define_global_function("fork", rb_f_fork, 0);

As you can see there's no #ifdef around rb_define_global_function("fork", ...).

I want to have a way to check whether rb_f_fork is implemented, without calling it and catching NotImplementedError.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2619

----------------------------------------
http://redmine.ruby-lang.org