diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-21 10:18:38 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-21 10:18:38 +0000 |
commit | 61acccefb7b90ab8dcbccc216e56c0ea61f1b54a (patch) | |
tree | bd5ea03be1886ee286df3f4568bbc82bffeeec4e /process.c | |
parent | d34079b17a82ca0c3012a9eb0b99689ac65c585c (diff) | |
download | ruby-61acccefb7b90ab8dcbccc216e56c0ea61f1b54a.tar.gz |
* process.c (pst_pid): use rb_attr_get to avoid warning on
Process::Status.allocate.pid.
(pst_inspect): don't raise if self is not initialized.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -271,7 +271,7 @@ pst_to_i(VALUE st) static VALUE pst_pid(VALUE st) { - return rb_iv_get(st, "pid"); + return rb_attr_get(st, rb_intern("pid")); } static void @@ -344,9 +344,13 @@ pst_inspect(VALUE st) { rb_pid_t pid; int status; - VALUE str; + VALUE vpid, str; - pid = NUM2LONG(pst_pid(st)); + vpid = pst_pid(st); + if (NIL_P(vpid)) { + return rb_sprintf("#<%s: uninitialized>", rb_class2name(CLASS_OF(st))); + } + pid = NUM2LONG(vpid); status = PST2INT(st); str = rb_sprintf("#<%s: ", rb_class2name(CLASS_OF(st))); |