Skip to content

Commit

Permalink
Fix rsync-shared shared folder path issues on Windows outside cygwin …
Browse files Browse the repository at this point in the history
…environment
  • Loading branch information
kasimi committed Jan 31, 2016
1 parent 95ffde0 commit 22495f5
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions plugins/synced_folders/rsync/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def self.rsync_single(machine, ssh_info, opts)
guestpath = machine.guest.capability(:rsync_scrub_guestpath, opts)
end

if Vagrant::Util::Platform.windows?
# rsync for Windows expects cygwin style paths, always.
hostpath = Vagrant::Util::Platform.cygwin_path(hostpath)
end
#if Vagrant::Util::Platform.windows?
# # rsync for Windows expects cygwin style paths, always.
# hostpath = Vagrant::Util::Platform.cygwin_path(hostpath)
#end

# Make sure the host path ends with a "/" to avoid creating
# a nested directory...
Expand Down Expand Up @@ -74,9 +74,9 @@ def self.rsync_single(machine, ssh_info, opts)
rsh = [
"ssh -p #{ssh_info[:port]} " +
proxy_command +
"-o ControlMaster=auto " +
"-o ControlPath=#{controlpath} " +
"-o ControlPersist=10m " +
#"-o ControlMaster=auto " +
#"-o ControlPath=#{controlpath} " +
#"-o ControlPersist=10m " +
"-o StrictHostKeyChecking=no " +
"-o IdentitiesOnly=true " +
"-o UserKnownHostsFile=/dev/null",
Expand Down Expand Up @@ -125,7 +125,7 @@ def self.rsync_single(machine, ssh_info, opts)
args,
"-e", rsh,
excludes.map { |e| ["--exclude", e] },
hostpath,
".", # hostpath,
"#{username}@#{host}:#{guestpath}",
].flatten

Expand All @@ -148,22 +148,24 @@ def self.rsync_single(machine, ssh_info, opts)
machine.guest.capability(:rsync_pre, opts)
end

if opts.include?(:verbose)
command_opts[:notify] = [:stdout, :stderr]
r = Vagrant::Util::Subprocess.execute(*(command + [command_opts])) {
|io_name,data| data.each_line { |line|
machine.ui.info("rsync[#{io_name}] -> #{line}") }
}
else
r = Vagrant::Util::Subprocess.execute(*(command + [command_opts]))
end

if r.exit_code != 0
raise Vagrant::Errors::RSyncError,
command: command.join(" "),
guestpath: guestpath,
hostpath: hostpath,
stderr: r.stderr
Dir.chdir(hostpath) do
if opts.include?(:verbose)
command_opts[:notify] = [:stdout, :stderr]
r = Vagrant::Util::Subprocess.execute(*(command + [command_opts])) {
|io_name,data| data.each_line { |line|
machine.ui.info("rsync[#{io_name}] -> #{line}") }
}
else
r = Vagrant::Util::Subprocess.execute(*(command + [command_opts]))
end

if r.exit_code != 0
raise Vagrant::Errors::RSyncError,
command: command.join(" "),
guestpath: guestpath,
hostpath: hostpath,
stderr: r.stderr
end
end

# If we have tasks to do after rsyncing, do those.
Expand Down

0 comments on commit 22495f5

Please sign in to comment.