1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* process.c (rb_f_system): returns nil on execution failure.

[ruby-core:13715]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-11-20 18:21:39 +00:00
parent 7da723cfbb
commit d154b1c346
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Wed Nov 21 03:12:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* process.c (rb_f_system): returns nil on execution failure.
[ruby-core:13715]
Wed Nov 21 01:04:12 2007 Yukihiro Matsumoto <matz@ruby-lang.org> Wed Nov 21 01:04:12 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* object.c (nil_plus): remove unused function. [ruby-core:13737] * object.c (nil_plus): remove unused function. [ruby-core:13737]

View file

@ -1758,10 +1758,11 @@ rb_spawn(int argc, VALUE *argv)
* call-seq: * call-seq:
* system(cmd [, arg, ...]) => true or false * system(cmd [, arg, ...]) => true or false
* *
* Executes _cmd_ in a subshell, returning +true+ if the command ran * Executes _cmd_ in a subshell, returning +true+ if the command
* successfully, +false+ otherwise. An error status is available in * gives zero exit status, +false+ for non zero exit status. Returns
* +nil+ if command execution fails. An error status is available in
* <code>$?</code>. The arguments are processed in the same way as * <code>$?</code>. The arguments are processed in the same way as
* for <code>Kernel::exec</code>, and raises same exceptions as it. * for <code>Kernel::exec</code>.
* *
* system("echo *") * system("echo *")
* system("echo", "*") * system("echo", "*")
@ -1795,7 +1796,7 @@ rb_f_system(int argc, VALUE *argv)
signal(SIGCHLD, chfunc); signal(SIGCHLD, chfunc);
#endif #endif
if (status < 0) { if (status < 0) {
rb_sys_fail(RSTRING_PTR(argv[0])); return Qnil;
} }
status = NUM2INT(rb_last_status_get()); status = NUM2INT(rb_last_status_get());
if (status == EXIT_SUCCESS) return Qtrue; if (status == EXIT_SUCCESS) return Qtrue;