mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
d34079b17a
commit
61acccefb7
3 changed files with 16 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Aug 21 19:17:02 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Thu Aug 21 19:05:40 2008 Tanaka Akira <akr@fsij.org>
|
Thu Aug 21 19:05:40 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* io.c (io_extract_encoding_option): if internal encoding is not
|
* io.c (io_extract_encoding_option): if internal encoding is not
|
||||||
|
|
10
process.c
10
process.c
|
@ -271,7 +271,7 @@ pst_to_i(VALUE st)
|
||||||
static VALUE
|
static VALUE
|
||||||
pst_pid(VALUE st)
|
pst_pid(VALUE st)
|
||||||
{
|
{
|
||||||
return rb_iv_get(st, "pid");
|
return rb_attr_get(st, rb_intern("pid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -344,9 +344,13 @@ pst_inspect(VALUE st)
|
||||||
{
|
{
|
||||||
rb_pid_t pid;
|
rb_pid_t pid;
|
||||||
int status;
|
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);
|
status = PST2INT(st);
|
||||||
|
|
||||||
str = rb_sprintf("#<%s: ", rb_class2name(CLASS_OF(st)));
|
str = rb_sprintf("#<%s: ", rb_class2name(CLASS_OF(st)));
|
||||||
|
|
|
@ -1001,4 +1001,7 @@ class TestProcess < Test::Unit::TestCase
|
||||||
assert(true == r || false == r)
|
assert(true == r || false == r)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_pst_inspect
|
||||||
|
assert_nothing_raised { Process::Status.allocate.inspect }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue