diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-02 18:51:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-02 18:51:21 +0000 |
commit | 4e133fdb7ed27123c0395a927e7f952b81b5bb2b (patch) | |
tree | f29551073a5c9ad2f22f3600677958f94b00da2a | |
parent | e1966b31e90b1ef9bdadd0f08121762f70fa12e5 (diff) | |
download | ruby-4e133fdb7ed27123c0395a927e7f952b81b5bb2b.tar.gz |
Just a shebang is valid code
[ruby-core:89240] [Bug #15190]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ruby.c | 6 | ||||
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 3 |
2 files changed, 4 insertions, 5 deletions
@@ -1913,11 +1913,7 @@ load_file_internal(VALUE argp_v) c = rb_io_getbyte(f); if (c == INT2FIX('#')) { c = rb_io_getbyte(f); - if (c == INT2FIX('!')) { - line = rb_io_gets(f); - if (NIL_P(line)) - return 0; - + if (c == INT2FIX('!') && !NIL_P(line = rb_io_gets(f))) { RSTRING_GETMEM(line, str, len); warn_cr_in_shebang(str, len); if ((p = strstr(str, ruby_engine)) == 0) { diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 371bfd5519..1417541282 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -403,6 +403,9 @@ class TestRubyOptions < Test::Unit::TestCase %w[4], [], bug4118) assert_ruby_status(%w[], "#! ruby -- /", '[ruby-core:82267] [Bug #13786]') + + assert_ruby_status(%w[], "#!") + assert_in_out_err(%w[-c], "#!", ["Syntax OK"]) end def test_flag_in_shebang |