From: nobu.nakada@... Date: 2004-07-16T10:12:00+09:00 Subject: [ruby-dev:23913] Re: Process::Status as boolean なかだです。 At Fri, 16 Jul 2004 09:49:32 +0900, Nobuyoshi-Nakada wrote in [ruby-dev:23912]: > 一つ見落としてました。SystemExitにもEXIT_SUCCESSかどうか調べる > メソッドがあったほうがいいと思います。 しまった、大ボケ。[ruby-dev:23912]からの修正差分です。 あと、まだEXIT_SUCCESSでなくて0を使っているところがありました。 diff -U2 error.c error.c --- error.c 16 Jul 2004 00:39:42 -0000 +++ error.c 16 Jul 2004 01:10:26 -0000 @@ -548,5 +548,5 @@ VALUE exc; { - VALUE status = INT2NUM(0); + VALUE status = INT2FIX(EXIT_SUCCESS); if (argc > 0 && FIXNUM_P(argv[0])) { status = *argv++; @@ -585,5 +585,8 @@ VALUE exc; { - return rb_attr_get(exc, rb_intern("status")) == EXIT_SUCCESS; + VALUE status = rb_attr_get(exc, rb_intern("status")); + if (NIL_P(status)) return Qtrue; + if (status == INT2FIX(EXIT_SUCCESS)) return Qtrue; + return Qfalse; } @@ -991,5 +994,5 @@ rb_define_method(rb_eSystemExit, "initialize", exit_initialize, -1); rb_define_method(rb_eSystemExit, "status", exit_status, 0); - rb_define_method(rb_eSystemExit, "status", exit_success_p, 0); + rb_define_method(rb_eSystemExit, "success?", exit_success_p, 0); rb_eFatal = rb_define_class("fatal", rb_eException); -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦