From d154b1c346448b432245d19147502bbffb796cb5 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 20 Nov 2007 18:21:39 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ process.c | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff63a59f40..49ec403c42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Nov 21 03:12:50 2007 Yukihiro Matsumoto + + * process.c (rb_f_system): returns nil on execution failure. + [ruby-core:13715] + Wed Nov 21 01:04:12 2007 Yukihiro Matsumoto * object.c (nil_plus): remove unused function. [ruby-core:13737] diff --git a/process.c b/process.c index 1518b21373..13f4bef765 100644 --- a/process.c +++ b/process.c @@ -1758,10 +1758,11 @@ rb_spawn(int argc, VALUE *argv) * call-seq: * system(cmd [, arg, ...]) => true or false * - * Executes _cmd_ in a subshell, returning +true+ if the command ran - * successfully, +false+ otherwise. An error status is available in + * Executes _cmd_ in a subshell, returning +true+ if the command + * gives zero exit status, +false+ for non zero exit status. Returns + * +nil+ if command execution fails. An error status is available in * $?. The arguments are processed in the same way as - * for Kernel::exec, and raises same exceptions as it. + * for Kernel::exec. * * system("echo *") * system("echo", "*") @@ -1795,7 +1796,7 @@ rb_f_system(int argc, VALUE *argv) signal(SIGCHLD, chfunc); #endif if (status < 0) { - rb_sys_fail(RSTRING_PTR(argv[0])); + return Qnil; } status = NUM2INT(rb_last_status_get()); if (status == EXIT_SUCCESS) return Qtrue;