summaryrefslogtreecommitdiff
path: root/lib/chef/mixin/template.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-06-07 17:17:00 -0700
committerdanielsdeleo <dan@opscode.com>2013-06-07 17:17:00 -0700
commitae7bc21674057c78716e5419752f99397090ce0c (patch)
treebf4e685ce22ff9c55849f79d82be841b54261aa4 /lib/chef/mixin/template.rb
parentf30eaa04407bb31819b65a80c018d00ac6a04409 (diff)
downloadchef-ae7bc21674057c78716e5419752f99397090ce0c.tar.gz
Explain optional \r in newline conversion regex
Diffstat (limited to 'lib/chef/mixin/template.rb')
-rw-r--r--lib/chef/mixin/template.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/mixin/template.rb b/lib/chef/mixin/template.rb
index f88263f34f..54aa65c488 100644
--- a/lib/chef/mixin/template.rb
+++ b/lib/chef/mixin/template.rb
@@ -140,6 +140,10 @@ class Chef
end
if windows_line_endings
+ # Convert line endings from "\n" -> "\r\n". Also converts
+ # "\r\n" -> "\r\n".
+ # This makes the regex match on all of "\r\n", so we don't
+ # accidentally convert "\r\n" -> "\r\r\n".
output = output.gsub(/\r?\n/,"\r\n")
end