1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval.c (terminate_process): take String message.

* eval.c (rb_thread_switch): propagate the exception caused thread
  termination directly.  fixed: [ruby-core:05552]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-08-17 14:58:47 +00:00
parent 311d02a322
commit 743d7affda
2 changed files with 17 additions and 11 deletions

View file

@ -1,3 +1,10 @@
Wed Aug 17 23:58:05 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (terminate_process): take String message.
* eval.c (rb_thread_switch): propagate the exception caused thread
termination directly. fixed: [ruby-core:05552]
Wed Aug 17 21:20:05 2005 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/lib/kconv.rb: ensure that symbol_to_option is private_class_method

19
eval.c
View file

@ -4352,16 +4352,15 @@ rb_mod_protected_method_defined(mod, mid)
return Qfalse;
}
NORETURN(static VALUE terminate_process _((int, const char *, long)));
NORETURN(static VALUE terminate_process _((int, VALUE)));
static VALUE
terminate_process(status, mesg, mlen)
terminate_process(status, mesg)
int status;
const char *mesg;
long mlen;
VALUE mesg;
{
VALUE args[2];
args[0] = INT2NUM(status);
args[1] = rb_str_new(mesg, mlen);
args[1] = mesg;
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
@ -4371,7 +4370,7 @@ rb_exit(status)
int status;
{
if (prot_tag) {
terminate_process(status, "exit", 4);
terminate_process(status, rb_str_new("exit", 4));
}
ruby_finalize();
exit(status);
@ -4476,9 +4475,9 @@ rb_f_abort(argc, argv)
VALUE mesg;
rb_scan_args(argc, argv, "1", &mesg);
StringValue(argv[0]);
rb_io_puts(argc, argv, rb_stderr);
terminate_process(EXIT_FAILURE, RSTRING(argv[0])->ptr, RSTRING(argv[0])->len);
StringValue(mesg);
rb_io_puts(1, &mesg, rb_stderr);
terminate_process(EXIT_FAILURE, mesg);
}
return Qnil; /* not reached */
}
@ -10489,7 +10488,7 @@ rb_thread_switch(n)
case RESTORE_EXIT:
ruby_errinfo = th_raise_exception;
ruby_current_node = th_raise_node;
terminate_process(sysexit_status(ruby_errinfo), 0, 0);
rb_exc_raise(th_raise_exception);
break;
case RESTORE_NORMAL:
default: