Process::Status.coredump? implementation w/ patch and ruby test script
----------------------------------------------------------------------

                 Key: JRUBY-5979
                 URL: https://jira.codehaus.org/browse/JRUBY-5979
             Project: JRuby
          Issue Type: Improvement
          Components: Core Classes/Modules
    Affects Versions: JRuby-OSSL 0.7.2
         Environment: Mac OSX Snow Leopard
            Reporter: Chris White
             Fix For: JRuby 1.7
         Attachments: 
0003-Add-a-temporary-implementation-for-Process-Status-co.patch, 
coredump_test.rb

While attempting to run the CRuby bootstrap test suite using JRuby, I noticed 
exceptions were occurring because Process::Status.coredump? was marked as not 
implemented. The CRuby version of coredump? is as follows:

-----
/*
 *  call-seq:
 *     stat.coredump?   -> true or false
 *
 *  Returns +true+ if _stat_ generated a coredump
 *  when it terminated. Not available on all platforms.
 */

static VALUE
pst_wcoredump(VALUE st)
{
#ifdef WCOREDUMP
    int status = PST2INT(st);

    if (WCOREDUMP(status))
        return Qtrue;
    else
        return Qfalse;
#else
    return Qfalse;
#endif
}
-----

It uses a system library macro, WCOREDUMP to check the status of a process 
inspected using the wait() system call. If WCOREDUMP is not present in the 
system implementation, false is returned. This could be completely implemented 
using a C wrapper that the Java side could interface with, but it would require 
a lot more legwork. Instead this patch has it return false as per the "not 
available on all platforms" condition (which is somewhat true if you consider 
pure Java the platform). 

Attached is both the patch and a Ruby Test::Unit::TestCase.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to