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

ruby-changes:23908

From: nobu <ko1@a...>
Date: Fri, 8 Jun 2012 11:30:19 +0900 (JST)
Subject: [ruby-changes:23908] nobu:r35959 (trunk): process.c, ext/pty/pty.c: status on errors

nobu	2012-06-08 11:26:39 +0900 (Fri, 08 Jun 2012)

  New Revision: 35959

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

  Log:
    process.c, ext/pty/pty.c: status on errors
    
    * process.c (rb_fork_err): determine status on errors.
    * ext/pty/pty.c (establishShell): reraise exception if something
      raised during sleep.

  Modified files:
    trunk/ChangeLog
    trunk/ext/pty/pty.c
    trunk/process.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35958)
+++ ChangeLog	(revision 35959)
@@ -1,5 +1,10 @@
-Fri Jun  8 11:25:51 2012  Nobuyoshi Nakada  <nobu@r...>
+Fri Jun  8 11:26:37 2012  Nobuyoshi Nakada  <nobu@r...>
 
+	* process.c (rb_fork_err): determine status on errors.
+
+	* ext/pty/pty.c (establishShell): reraise exception if something
+	  raised during sleep.
+
 	* ext/pty/pty.c (establishShell): now needs status to protect from
 	  exceptions in rb_fork_err().
 
Index: process.c
===================================================================
--- process.c	(revision 35958)
+++ process.c	(revision 35959)
@@ -2736,7 +2736,9 @@
  * process.
  *
  * If +status+ is given, protects from any exceptions and sets the
- * jump status to it.
+ * jump status to it, and returns -1.  If failed to fork new process
+ * but no exceptions occurred, sets 0 to it.  Otherwise, if forked
+ * successfully, the value of +status+ is undetermined.
  *
  * In the child process, just returns 0 if +chfunc+ is +NULL+.
  * Otherwise +chfunc+ will be called with +charg+, and then the child
@@ -2773,6 +2775,7 @@
 
 #ifdef FD_CLOEXEC
     if (chfunc) {
+	if (status) *status = 0;
 	if (pipe_nocrash(ep, fds)) return -1;
 	if (fcntl(ep[1], F_SETFD, FD_CLOEXEC)) {
 	    preserving_errno((close(ep[0]), close(ep[1])));
Index: ext/pty/pty.c
===================================================================
--- ext/pty/pty.c	(revision 35958)
+++ ext/pty/pty.c	(revision 35959)
@@ -196,6 +196,7 @@
 	close(master);
 	close(slave);
 	errno = e;
+	if (status) rb_jump_tag(status);
 	rb_sys_fail(errbuf[0] ? errbuf : "fork failed");
     }
 

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

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