Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby-OSSL 0.7.2
-
Fix Version/s: JRuby 1.6.4
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:Mac OSX Snow Leopard
-
Testcase included:yes
-
Patch Submitted:Yes
-
Number of attachments :
Description
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.
I think I just figured out how Jira formatting works so here's another attempt at the code paste: