Properly determine shared folder path even if .profile echos [GH-1677]

This commit is contained in:
Mitchell Hashimoto 2013-07-19 23:53:53 -04:00
parent 8379d0e20e
commit f4c36795df
2 changed files with 5 additions and 1 deletions

View File

@ -35,6 +35,7 @@ BUG FIXES:
- Solaris guests actually shut down properly. [GH-1506] - Solaris guests actually shut down properly. [GH-1506]
- All provisioners only output newlines when the provisioner sends a - All provisioners only output newlines when the provisioner sends a
newline. This results in the output looking a lot nicer. newline. This results in the output looking a lot nicer.
- Sharing folders works properly if ".profile" contains an echo. [GH-1677]
## 1.2.4 (July 16, 2013) ## 1.2.4 (July 16, 2013)

View File

@ -4,13 +4,16 @@ module VagrantPlugins
class ShellExpandGuestPath class ShellExpandGuestPath
def self.shell_expand_guest_path(machine, path) def self.shell_expand_guest_path(machine, path)
real_path = nil real_path = nil
machine.communicate.execute("printf #{path}") do |type, data| machine.communicate.execute("echo; printf #{path}") do |type, data|
if type == :stdout if type == :stdout
real_path ||= "" real_path ||= ""
real_path += data real_path += data
end end
end end
# The last line is the path we care about
real_path = real_path.split("\n").last.chomp
if !real_path if !real_path
# If no real guest path was detected, this is really strange # If no real guest path was detected, this is really strange
# and we raise an exception because this is a bug. # and we raise an exception because this is a bug.