ruby-changes:13550
From: nobu <ko1@a...>
Date: Wed, 14 Oct 2009 13:24:31 +0900 (JST)
Subject: [ruby-changes:13550] Ruby:r25330 (trunk): * ruby.c (process_options): script name should not be shown in an
nobu 2009-10-14 13:24:16 +0900 (Wed, 14 Oct 2009) New Revision: 25330 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25330 Log: * ruby.c (process_options): script name should not be shown in an error message before loaded. Modified files: trunk/ChangeLog trunk/ruby.c trunk/test/ruby/test_rubyoptions.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 25329) +++ ChangeLog (revision 25330) @@ -1,3 +1,8 @@ +Wed Oct 14 13:24:14 2009 Nobuyoshi Nakada <nobu@r...> + + * 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 <nobu@r...> * eval.c (ruby_run_node): need to call ruby_cleaup() always even Index: ruby.c =================================================================== --- ruby.c (revision 25329) +++ ruby.c (revision 25330) @@ -1341,8 +1341,6 @@ } } 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 @@ 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) { Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 25329) +++ test/ruby/test_rubyoptions.rb (revision 25330) @@ -311,4 +311,13 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/