Commit d81e4d71 authored by KOBAYASHI Shuji's avatar KOBAYASHI Shuji

Allow `true`/`false` argument to `Kernel#exit`

parent 1bb1df19
......@@ -4,12 +4,17 @@
static mrb_value
f_exit(mrb_state *mrb, mrb_value self)
{
mrb_int i = EXIT_SUCCESS;
mrb_value status = mrb_true_value();
int istatus;
mrb_get_args(mrb, "|o", &status);
istatus = mrb_true_p(status) ? EXIT_SUCCESS :
mrb_false_p(status) ? EXIT_FAILURE :
(int)mrb_int(mrb, status);
exit(istatus);
mrb_get_args(mrb, "|i", &i);
exit((int)i);
/* not reached */
return mrb_nil_value();
return status;
}
void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment