diff options
author | Jesse Campbell <hikeit@gmail.com> | 2013-03-01 22:12:52 -0500 |
---|---|---|
committer | Jesse Campbell <hikeit@gmail.com> | 2013-03-01 22:12:52 -0500 |
commit | ddf3acfee7b296df3e9b9692676e393e96f2f90a (patch) | |
tree | 485b240c59209b788c272fe53db25a289df2eb36 | |
parent | dade9779168a75c84be1e964517412fc89798405 (diff) | |
download | chef-ddf3acfee7b296df3e9b9692676e393e96f2f90a.tar.gz |
set binmode for tempfiles on windows
-rw-r--r-- | lib/chef/provider/remote_file/ftp.rb | 3 | ||||
-rw-r--r-- | lib/chef/provider/remote_file/local_file.rb | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb index 24d3a1e891..f951bcaecd 100644 --- a/lib/chef/provider/remote_file/ftp.rb +++ b/lib/chef/provider/remote_file/ftp.rb @@ -82,6 +82,9 @@ class Chef # Fetches using Net::FTP, returns a Tempfile with the content def fetch tempfile = Tempfile.new(@filename) + if Chef::Platform.windows? + tempfile.binmode #required for binary files on Windows platforms + end if @typecode @ftp.voidcmd("TYPE #{@typecode.upcase}") end diff --git a/lib/chef/provider/remote_file/local_file.rb b/lib/chef/provider/remote_file/local_file.rb index 9a07621d14..3b64318f6e 100644 --- a/lib/chef/provider/remote_file/local_file.rb +++ b/lib/chef/provider/remote_file/local_file.rb @@ -32,6 +32,9 @@ class Chef tempfile = nil else tempfile = Tempfile.new(::File.basename(uri.path)) + if Chef::Platform.windows? + tempfile.binmode #required for binary files on Windows platforms + end Chef::Log.debug("#{@new_resource} staging #{uri.path} to #{tempfile.path}") FileUtils.cp(uri.path, tempfile.path) tempfile |