summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-27 15:34:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-27 15:34:53 +0000
commit99fb5f48711dc3267dc008060e9f5b97434c5121 (patch)
treed258c8e544250e7bb63c51404a28ebe5d0eb791f /eval.c
parent868d5ba485b1d50fe1163fd9f63fe43a34ca402e (diff)
* eval.c (rb_f_exit), process.c (rb_f_exit_bang): treat true as
success, false as failure. [ruby-dev:22067] * eval.c (rb_f_abort, rb_thread_switch), process.c (rb_f_system): use ANSI macro instead of hard coded value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 217c5c7f49..5cfee877ec 100644
--- a/eval.c
+++ b/eval.c
@@ -3895,7 +3895,17 @@ rb_f_exit(argc, argv)
rb_secure(4);
if (rb_scan_args(argc, argv, "01", &status) == 1) {
- istatus = NUM2INT(status);
+ switch (status) {
+ case T_TRUE:
+ istatus = EXIT_SUCCESS;
+ break;
+ case T_FALSE:
+ istatus = EXIT_FAILURE;
+ break;
+ default:
+ istatus = NUM2INT(status);
+ break;
+ }
}
else {
istatus = EXIT_SUCCESS;
@@ -3922,7 +3932,7 @@ rb_f_abort(argc, argv)
rb_scan_args(argc, argv, "1", &mesg);
StringValue(argv[0]);
rb_io_puts(argc, argv, rb_stderr);
- terminate_process(1, RSTRING(argv[0])->ptr, RSTRING(argv[0])->len);
+ terminate_process(EXIT_FAILURE, RSTRING(argv[0])->ptr, RSTRING(argv[0])->len);
}
return Qnil; /* not reached */
}
@@ -8407,7 +8417,7 @@ rb_thread_switch(n)
ruby_errinfo = th_raise_argv[0];
ruby_current_node = th_raise_node;
error_print();
- terminate_process(1, 0, 0);
+ terminate_process(EXIT_FAILURE, 0, 0);
break;
case RESTORE_NORMAL:
default: