summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-15 10:53:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-04-15 10:53:12 +0000
commitb3db09df79386f602b513e064f4e886f5ac6672d (patch)
treeba250828bc62e84aee402d1ddd32572d9197af67 /process.c
parent7ab8be45db300d17245dba9bb38d71e1b885a422 (diff)
* process.c (pst_success_p): new method Process::Status#success?.
[ruby-dev:23385] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6165 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 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.