Skip to content

Commit

Permalink
Fix Windows shell provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
obscurerichard committed Oct 12, 2012
1 parent be0bc66 commit 780dc31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/vagrant/communication/ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def upload(from, to)
# Do an SCP-based upload...
connect do |connection|
scp = Net::SCP.new(connection)
scp.upload!(from, to)
# Open file read only to fix issue #1036
scp.upload!(File.open(from, "r"), to)
end
rescue Net::SCP::Error => e
# If we get the exit code of 127, then this means SCP is unavailable.
Expand Down
4 changes: 4 additions & 0 deletions lib/vagrant/provisioners/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def with_script_file
# 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
file.binmode
begin
file.write(config.inline)
file.fsync
Expand Down

0 comments on commit 780dc31

Please sign in to comment.