[前][次][番号順一覧][スレッド一覧]

ruby-changes:2499

From: ko1@a...
Date: 21 Nov 2007 03:21:55 +0900
Subject: [ruby-changes:2499] matz - Ruby:r13990 (trunk): * process.c (rb_f_system): returns nil on execution failure.

matz	2007-11-21 03:21:39 +0900 (Wed, 21 Nov 2007)

  New Revision: 13990

  Modified files:
    trunk/ChangeLog
    trunk/process.c

  Log:
    * process.c (rb_f_system): returns nil on execution failure.
      [ruby-core:13715]

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13990&r2=13989
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/process.c?r1=13990&r2=13989

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13989)
+++ ChangeLog	(revision 13990)
@@ -1,3 +1,8 @@
+Wed Nov 21 03:12:50 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* process.c (rb_f_system): returns nil on execution failure.
+	  [ruby-core:13715]
+
 Wed Nov 21 01:04:12 2007  Yukihiro Matsumoto  <matz@r...>
 
 	* object.c (nil_plus): remove unused function.  [ruby-core:13737]
Index: process.c
===================================================================
--- process.c	(revision 13989)
+++ process.c	(revision 13990)
@@ -1758,10 +1758,11 @@
  *  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
  *  <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", "*")
@@ -1795,7 +1796,7 @@
     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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]