ruby-changes:6863
From: nobu <ko1@a...>
Date: Wed, 6 Aug 2008 06:57:19 +0900 (JST)
Subject: [ruby-changes:6863] Ruby:r18381 (trunk): * thread.c (thread_start_func_2): propagates fatal error and system
nobu 2008-08-06 06:55:23 +0900 (Wed, 06 Aug 2008) New Revision: 18381 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18381 Log: * thread.c (thread_start_func_2): propagates fatal error and system exit to the main thread. Modified files: trunk/ChangeLog trunk/thread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 18380) +++ ChangeLog (revision 18381) @@ -1,3 +1,8 @@ +Wed Aug 6 06:55:20 2008 Nobuyoshi Nakada <nobu@r...> + + * thread.c (thread_start_func_2): propagates fatal error and system + exit to the main thread. + Wed Aug 6 05:31:54 2008 Nobuyoshi Nakada <nobu@r...> * encoding.c (rb_to_encoding_index, rb_to_encoding): check if the name Index: thread.c =================================================================== --- thread.c (revision 18380) +++ thread.c (revision 18381) @@ -382,12 +382,26 @@ }); } else { - if (th->safe_level < 4 && - (th->vm->thread_abort_on_exception || - th->abort_on_exception || RTEST(ruby_debug))) { - errinfo = th->errinfo; - if (NIL_P(errinfo)) errinfo = rb_errinfo(); + errinfo = th->errinfo; + if (NIL_P(errinfo)) errinfo = rb_errinfo(); + if (state == TAG_FATAL) { + /* fatal error within this thread, need to stop whole script */ } + else if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) { + if (th->safe_level >= 4) { + th->errinfo = rb_exc_new3(rb_eSecurityError, + rb_sprintf("Insecure exit at level %d", th->safe_level)); + errinfo = Qnil; + } + } + else if (th->safe_level < 4 && + (th->vm->thread_abort_on_exception || + th->abort_on_exception || RTEST(ruby_debug))) { + /* exit on main_thread */ + } + else { + errinfo = Qnil; + } th->value = Qnil; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/