mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
e1966b31e9
commit
4e133fdb7e
2 changed files with 4 additions and 5 deletions
6
ruby.c
6
ruby.c
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue