summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-15 14:21:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-15 14:21:55 +0000
commit280ee0095f2cc0393d6dcced98ef7d60a8e1a984 (patch)
tree837d9fa7ea494da815db3bfaa122a60a537e1e94 /process.c
parent8f7d69291df82cfce5989bb74a6226026acfd513 (diff)
* process.c (pst_success_p): new method Process::Status#success?.
[ruby-dev:23385] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/process.c b/process.c
index bec82ae..dc59ec1 100644
--- a/process.c
+++ b/process.c
@@ -505,7 +505,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.