pass ARGV to main.rb; catch bootstrapping exceptions
This commit is contained in:
parent
f0db52e3d7
commit
2d7d3d14ab
@ -1 +1,6 @@
|
||||
def main
|
||||
puts "hi from main.rb"
|
||||
p ARGV
|
||||
end
|
||||
|
||||
main
|
||||
|
14
src/main.cc
14
src/main.cc
@ -6,6 +6,14 @@ using namespace std;
|
||||
|
||||
RUBY_GLOBAL_SETUP
|
||||
|
||||
static void handle_bootstrap_error()
|
||||
{
|
||||
VALUE e = rb_errinfo();
|
||||
VALUE s = rb_funcall(e, rb_intern("message"), 0);
|
||||
fprintf(stderr, "%s\n", StringValueCStr(s));
|
||||
rb_set_errinfo(Qnil);
|
||||
}
|
||||
|
||||
static int bootstrap()
|
||||
{
|
||||
int rv = 0;
|
||||
@ -15,10 +23,7 @@ static int bootstrap()
|
||||
&err_state);
|
||||
if (err_state != 0)
|
||||
{
|
||||
VALUE e = rb_errinfo();
|
||||
VALUE s = rb_funcall(e, rb_intern("message"), 0);
|
||||
fprintf(stderr, "%s\n", StringValueCStr(s));
|
||||
rb_set_errinfo(Qnil);
|
||||
handle_bootstrap_error();
|
||||
rv = 1;
|
||||
}
|
||||
return rv;
|
||||
@ -37,6 +42,7 @@ int main(int argc, char *argv[])
|
||||
ruby_init();
|
||||
ruby_init_loadpath();
|
||||
ruby_script(argv[0]);
|
||||
ruby_set_argv(argc, argv);
|
||||
rv = bootstrap();
|
||||
ruby_finalize();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user