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

ruby-changes:50449

From: nobu <ko1@a...>
Date: Sun, 25 Feb 2018 12:08:47 +0900 (JST)
Subject: [ruby-changes:50449] nobu:r62571 (trunk): guard before noreturn function

nobu	2018-02-25 12:08:40 +0900 (Sun, 25 Feb 2018)

  New Revision: 62571

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

  Log:
    guard before noreturn function

  Modified files:
    trunk/process.c
Index: process.c
===================================================================
--- process.c	(revision 62570)
+++ process.c	(revision 62571)
@@ -4097,8 +4097,9 @@ rb_f_system(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L4097
     if (pid < 0) {
         if (eargp->exception) {
             int err = errno;
-            rb_syserr_fail_str(err, eargp->invoke.sh.shell_script);
+            VALUE command = eargp->invoke.sh.shell_script;
             RB_GC_GUARD(execarg_obj);
+            rb_syserr_fail_str(err, command);
         }
         else {
             return Qnil;
@@ -4107,11 +4108,12 @@ rb_f_system(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L4108
     status = PST2INT(rb_last_status_get());
     if (status == EXIT_SUCCESS) return Qtrue;
     if (eargp->exception) {
+        VALUE command = eargp->invoke.sh.shell_script;
         VALUE str = rb_str_new_cstr("Command failed with");
         rb_str_cat_cstr(pst_message_status(str, status), ": ");
-        rb_str_append(str, eargp->invoke.sh.shell_script);
-        rb_exc_raise(rb_exc_new_str(rb_eRuntimeError, str));
+        rb_str_append(str, command);
         RB_GC_GUARD(execarg_obj);
+        rb_exc_raise(rb_exc_new_str(rb_eRuntimeError, str));
     }
     else {
         return Qfalse;

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

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