summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--process.c22
2 files changed, 26 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 37eb806936..e751e86021 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Apr 15 19:53:08 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (pst_success_p): new method Process::Status#success?.
+ [ruby-dev:23385]
+
Thu Apr 15 19:26:54 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* dir.c (rb_push_glob): Dir.glob() should return nil if block is given.
diff --git a/process.c b/process.c
index d252c0fa89..4c15e67a2a 100644
--- a/process.c
+++ b/process.c
@@ -511,7 +511,27 @@ 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
* when it terminated. Not available on all platforms.