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

ruby-changes:28500

From: nobu <ko1@a...>
Date: Thu, 2 May 2013 13:02:42 +0900 (JST)
Subject: [ruby-changes:28500] nobu:r40552 (trunk): process.c: fix failed status with spawnv

nobu	2013-05-02 13:02:32 +0900 (Thu, 02 May 2013)

  New Revision: 40552

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40552

  Log:
    process.c: fix failed status with spawnv
    
    * process.c (proc_spawn_cmd_internal, proc_spawn_sh): spawn() with
      P_NOWAIT returns process ID, so it must not be set as a status.
    
    * process.c (rb_spawn_process): set failed status on error on
      platforms using spawnv not only on Windows.

  Modified files:
    trunk/process.c

Index: process.c
===================================================================
--- process.c	(revision 40551)
+++ process.c	(revision 40552)
@@ -1395,7 +1395,6 @@ proc_spawn_cmd_internal(char **argv, cha https://github.com/ruby/ruby/blob/trunk/process.c#L1395
 	after_exec();
 	if (status == -1) errno = ENOEXEC;
     }
-    rb_last_status_set(status == -1 ? 127 : status, 0);
     return status;
 }
 #endif
@@ -1431,7 +1430,6 @@ proc_spawn_sh(char *str) https://github.com/ruby/ruby/blob/trunk/process.c#L1430
     char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
     before_exec();
     status = spawnl(P_NOWAIT, (shell ? shell : "/bin/sh"), "sh", "-c", str, (char*)NULL);
-    rb_last_status_set(status == -1 ? 127 : status, 0);
     after_exec();
     return status;
 }
@@ -3686,10 +3684,8 @@ rb_spawn_process(struct rb_execarg *earg https://github.com/ruby/ruby/blob/trunk/process.c#L3684
         char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
 	pid = proc_spawn_cmd(argv, prog, eargp);
     }
-#  if defined(_WIN32)
     if (pid == -1)
 	rb_last_status_set(0x7f << 8, 0);
-#  endif
 # else
     if (!eargp->use_shell) {
         char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);

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

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