diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-14 04:24:16 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-14 04:24:16 +0000 |
commit | 0e4121aa5ba9875f3b2d3b130cc4f63a1f50fc26 (patch) | |
tree | a28b030469229d6ee23ff09664dfa12bca35c88f | |
parent | fe01a3434da6ea3e3f2bf0bc0b0ad1447f12f4b8 (diff) | |
download | ruby-0e4121aa5ba9875f3b2d3b130cc4f63a1f50fc26.tar.gz |
* ruby.c (process_options): script name should not be shown in an
error message before loaded.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ruby.c | 4 | ||||
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 9 |
3 files changed, 16 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Wed Oct 14 13:24:14 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@ruby-lang.org> * eval.c (ruby_run_node): need to call ruby_cleaup() always even @@ -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 |