mirror of
https://github.com/github/rails.git
synced 2026-02-01 17:54:59 -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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user