mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread.c (thread_start_func_2): propagates fatal error and system
exit to the main thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c97a842391
commit
3af2559d17
2 changed files with 24 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Aug 6 06:55:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* encoding.c (rb_to_encoding_index, rb_to_encoding): check if the name
|
||||
|
|
24
thread.c
24
thread.c
|
@ -382,11 +382,25 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
|
|||
});
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue