mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix shebang handling for empty files. References #2927.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3258 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
3fb5828621
commit
b056adf03b
1 changed files with 3 additions and 4 deletions
|
@ -220,12 +220,11 @@ module Rails
|
|||
if block_given?
|
||||
df.write(yield(sf))
|
||||
else
|
||||
line = sf.gets || ''
|
||||
if file_options[:shebang]
|
||||
df.puts("#!#{file_options[:shebang]}")
|
||||
df.puts(line) if line !~ /^#!/
|
||||
else
|
||||
df.puts(line)
|
||||
if line = sf.gets
|
||||
df.puts(line) if line !~ /^#!/
|
||||
end
|
||||
end
|
||||
df.write(sf.read)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue