[Win32utils-devel] Converting rb_protect + ruby_stop to pure Ruby

Daniel Berger djberg96 at gmail.com
Mon May 1 20:17:39 EDT 2006


Hi,

Within process.c, in the fork method, there's this bit of code:

if(rb_block_given_p()){
    int status;
    rb_protect(rb_yield, Qundef, &status);
    ruby_stop(status);
}


I translated that as this:

if block_given?
    status = 0
    begin
       yield
    rescue Exception
       status = -1 # Any non-zero result is failure
    end
    exit(status)
end

Is there a way to get the actual status? The $? global isn't set at this 
point so that doesn't seem to be an option.  Or is this a reasonable 
default?

This isn't crucial but I thought I'd ask.

Thanks,

Dan



More information about the win32utils-devel mailing list