diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-15 10:53:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-15 10:53:12 +0000 |
commit | 2767549e893143aafcddcc1998945fec986144b3 (patch) | |
tree | ba250828bc62e84aee402d1ddd32572d9197af67 | |
parent | 8b4e31491fe83fddd69b9d55776a7bfc8afb5962 (diff) | |
download | ruby-2767549e893143aafcddcc1998945fec986144b3.tar.gz ruby-2767549e893143aafcddcc1998945fec986144b3.tar.xz ruby-2767549e893143aafcddcc1998945fec986144b3.zip |
* process.c (pst_success_p): new method Process::Status#success?.
[ruby-dev:23385]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | process.c | 22 |
2 files changed, 26 insertions, 1 deletions
@@ -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. @@ -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. |