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

ruby-changes:39209

From: nobu <ko1@a...>
Date: Sat, 18 Jul 2015 18:45:37 +0900 (JST)
Subject: [ruby-changes:39209] nobu:r51290 (trunk): eval.c: extra conversion of exit status

nobu	2015-07-18 18:45:25 +0900 (Sat, 18 Jul 2015)

  New Revision: 51290

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

  Log:
    eval.c: extra conversion of exit status
    
    * eval.c (ruby_cleanup): error_handle() returns exit status to the
      system, not internal error state, do not convert the exit status
      again.

  Modified files:
    trunk/ChangeLog
    trunk/eval.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51289)
+++ ChangeLog	(revision 51290)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jul 18 18:45:22 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval.c (ruby_cleanup): error_handle() returns exit status to the
+	  system, not internal error state, do not convert the exit status
+	  again.
+
 Sat Jul 18 10:29:03 2015  Eric Wong  <e@8...>
 
 	* test/ruby/test_process.rb: test thread+sigs work after failed exec
Index: eval.c
===================================================================
--- eval.c	(revision 51289)
+++ eval.c	(revision 51290)
@@ -164,6 +164,7 @@ ruby_cleanup(volatile int ex) https://github.com/ruby/ruby/blob/trunk/eval.c#L164
     volatile VALUE errs[2];
     rb_thread_t *th = GET_THREAD();
     int nerr;
+    volatile int sysex = EXIT_SUCCESS;
 
     rb_threadptr_interrupt(th);
     rb_threadptr_check_signal(th);
@@ -195,22 +196,11 @@ ruby_cleanup(volatile int ex) https://github.com/ruby/ruby/blob/trunk/eval.c#L196
 	ex = state;
     }
     th->errinfo = errs[1];
-    ex = error_handle(ex);
-
-#if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
-    switch (ex) {
-#if EXIT_SUCCESS != 0
-      case 0: ex = EXIT_SUCCESS; break;
-#endif
-#if EXIT_FAILURE != 1
-      case 1: ex = EXIT_FAILURE; break;
-#endif
-    }
-#endif
+    sysex = error_handle(ex);
 
     state = 0;
     for (nerr = 0; nerr < numberof(errs); ++nerr) {
-	VALUE err = errs[nerr];
+	VALUE err = ATOMIC_SIZE_EXCHANGE(errs[nerr], Qnil);
 
 	if (!RTEST(err)) continue;
 
@@ -218,7 +208,7 @@ ruby_cleanup(volatile int ex) https://github.com/ruby/ruby/blob/trunk/eval.c#L208
 	if (THROW_DATA_P(err)) continue;
 
 	if (rb_obj_is_kind_of(err, rb_eSystemExit)) {
-	    ex = sysexit_status(err);
+	    sysex = sysexit_status(err);
 	    break;
 	}
 	else if (rb_obj_is_kind_of(err, rb_eSignal)) {
@@ -226,8 +216,8 @@ ruby_cleanup(volatile int ex) https://github.com/ruby/ruby/blob/trunk/eval.c#L216
 	    state = NUM2INT(sig);
 	    break;
 	}
-	else if (ex == EXIT_SUCCESS) {
-	    ex = EXIT_FAILURE;
+	else if (sysex == EXIT_SUCCESS) {
+	    sysex = EXIT_FAILURE;
 	}
     }
 
@@ -240,7 +230,7 @@ ruby_cleanup(volatile int ex) https://github.com/ruby/ruby/blob/trunk/eval.c#L230
     ruby_vm_destruct(GET_VM());
     if (state) ruby_default_signal(state);
 
-    return ex;
+    return sysex;
 }
 
 static int

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

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