Merge pull request #1183 from obscurerichard/fix-windows-shell-provisioning-vs-master

Fix Windows shell provisioning.
This commit is contained in:
Mitchell Hashimoto 2012-10-12 19:49:34 -07:00
commit 256ebd4dbe
2 changed files with 6 additions and 1 deletions

View File

@ -94,7 +94,8 @@ module VagrantPlugins
@logger.debug("Uploading: #{from} to #{to}")
scp_connect do |scp|
scp.upload!(from, to)
# Open file read only to fix issue [GH-1036]
scp.upload!(File.open(from, "r"), to)
end
rescue RuntimeError => e
# Net::SCP raises a runtime error for this so the only way we have

View File

@ -60,6 +60,10 @@ module VagrantPlugins
# Otherwise we have an inline script, we need to Tempfile it,
# and handle it specially...
file = Tempfile.new('vagrant-shell')
# Unless you set binmode, on a Windows host the shell script will
# have CRLF line endings instead of LF line endings, causing havoc
# when the guest executes it. This fixes [GH-1181].
file.binmode
begin
file.write(config.inline)
file.fsync