[#23332] to_str再考 — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

15 messages 2004/04/05

[#23380] [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

山本です。

17 messages 2004/04/15
[#23400] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。落ちる場所がわかりました。

[#23402] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。

[#23403] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — nobu.nakada@... 2004/04/16

なかだです。

[#23405] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。

[#23407] Re: [SEGV] make test-all (bccwin32 ruby1.9.0) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2004/04/16

山本です。

[ruby-dev:23385] Process::Status as boolean

From: nobu.nakada@...
Date: 2004-04-15 08:59:49 UTC
List: ruby-dev #23385
なかだです。

systemの戻り値は成功/失敗をシステムに依存しない形で判定できます
が、Process::waitpidや``の場合、$?.exitstatusを使う必要があって
EXIT_SUCCESSの値に依存してしまいます。

で、exitstatus==EXIT_SUCCESSを返す、Process::Status#success?と
いうメソッドはどうでしょうか。Process::EXIT_SUCCESSなどの定数で
もいいんですが、systemとの一貫性からはこっちのほうがいいと思い
ます。


Index: process.c
===================================================================
RCS file: /cvs/ruby/src/ruby/process.c,v
retrieving revision 1.102
diff -u -2 -p -r1.102 process.c
--- process.c	14 Apr 2004 04:06:25 -0000	1.102
+++ process.c	15 Apr 2004 08:57:17 -0000
@@ -512,5 +512,25 @@ pst_wexitstatus(st)
 /*
  *  call-seq:
- *     stat.coredump   => true or false
+ *     stat.success?   => true, false or nil
+ *  
+ *  Returns +true+ if _stat_ is successful, +false+ if not.
+ *  Returns +nil+ if <code>exited?</code> is not +true+.
+ */
+
+static VALUE
+pst_success_p(st)
+    VALUE st;
+{
+    int status = NUM2INT(st);
+
+    if (!WIFEXITED(status))
+	return Qnil;
+    return WEXITSTATUS(status) == EXIT_SUCCESS ? Qtrue : Qfalse;
+}
+
+
+/*
+ *  call-seq:
+ *     stat.coredump?   => true or false
  *  
  *  Returns +true+ if _stat_ generated a coredump


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread

Prev Next