diff --git a/ChangeLog b/ChangeLog index 0b5a068df3..fc56787c32 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 14 13:24:14 2009 Nobuyoshi Nakada + + * ruby.c (process_options): script name should not be shown in an + error message before loaded. + Wed Oct 14 09:06:38 2009 Nobuyoshi Nakada * eval.c (ruby_run_node): need to call ruby_cleaup() always even diff --git a/ruby.c b/ruby.c index 28bcf31691..4f2f7d4b5a 100644 --- a/ruby.c +++ b/ruby.c @@ -1341,8 +1341,6 @@ process_options(int argc, char **argv, struct cmdline_options *opt) } } ruby_init_gems(!(opt->disable & DISABLE_BIT(gems))); - rb_progname = opt->script_name; - rb_vm_set_progname(rb_progname); ruby_set_argv(argc, argv); process_sflag(&opt->sflag); @@ -1387,6 +1385,8 @@ process_options(int argc, char **argv, struct cmdline_options *opt) tree = load_file(parser, opt->script, 1, opt); }); } + rb_progname = opt->script_name; + rb_vm_set_progname(rb_progname); if (opt->dump & DUMP_BIT(yydebug)) return Qtrue; if (opt->ext.enc.index >= 0) { diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 87d2200ad2..4e78b4c827 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -311,4 +311,13 @@ class TestRubyOptions < Test::Unit::TestCase ensure t.close(true) if t end + + def test_notfound + notexist = "./notexist.rb" + rubybin = Regexp.quote(EnvUtil.rubybin) + pat = /\A#{rubybin}:.* -- #{Regexp.quote(notexist)} \(LoadError\)\Z/ + assert_equal(false, File.exist?(notexist)) + assert_in_out_err(["-r", notexist, "-ep"], [], [], pat) + assert_in_out_err([notexist], [], [], pat) + end end