1
0
Fork 0
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:
Jeremy Kemper 2005-12-09 18:47:23 +00:00
parent 3fb5828621
commit b056adf03b

View file

@ -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