Merge pull request #8918 from briancain/8917/master/fix-expand-path-cap
Fix shell_expand_guest_path capability
This commit is contained in:
commit
c84184d3ca
|
@ -4,7 +4,8 @@ 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|
|
path = path.gsub(/ /, '\ ')
|
||||||
|
machine.communicate.execute("printf #{path}") do |type, data|
|
||||||
if type == :stdout
|
if type == :stdout
|
||||||
real_path ||= ""
|
real_path ||= ""
|
||||||
real_path += data
|
real_path += data
|
||||||
|
|
|
@ -4,7 +4,8 @@ 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}\"",
|
path = path.gsub(/ /, '\ ')
|
||||||
|
machine.communicate.execute("printf #{path}",
|
||||||
shell: "sh") do |type, data|
|
shell: "sh") do |type, data|
|
||||||
if type == :stdout
|
if type == :stdout
|
||||||
real_path ||= ""
|
real_path ||= ""
|
||||||
|
|
|
@ -4,7 +4,8 @@ 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("echo; printf \"#{path}\"") do |type, data|
|
path = path.gsub(/ /, '\ ')
|
||||||
|
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
|
||||||
|
|
|
@ -4,7 +4,8 @@ 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|
|
path = path.gsub(/ /, '\ ')
|
||||||
|
machine.communicate.execute("printf #{path}") do |type, data|
|
||||||
if type == :stdout
|
if type == :stdout
|
||||||
real_path ||= ""
|
real_path ||= ""
|
||||||
real_path += data
|
real_path += data
|
||||||
|
|
|
@ -4,7 +4,8 @@ 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|
|
path = path.gsub(/ /, '\ ')
|
||||||
|
machine.communicate.execute("printf #{path}") do |type, data|
|
||||||
if type == :stdout
|
if type == :stdout
|
||||||
real_path ||= ""
|
real_path ||= ""
|
||||||
real_path += data
|
real_path += data
|
||||||
|
|
|
@ -33,10 +33,11 @@ describe "VagrantPlugins::GuestDarwin::Cap::ShellExpandGuestPath" do
|
||||||
|
|
||||||
it "returns a path with a space in it" do
|
it "returns a path with a space in it" do
|
||||||
path = "/home/vagrant folder/folder"
|
path = "/home/vagrant folder/folder"
|
||||||
|
path_with_spaces = "/home/vagrant\\ folder/folder"
|
||||||
allow(machine.communicate).to receive(:execute).
|
allow(machine.communicate).to receive(:execute).
|
||||||
with(any_args).and_yield(:stdout, "/home/vagrant folder/folder")
|
with(any_args).and_yield(:stdout, path_with_spaces)
|
||||||
|
|
||||||
expect(machine.communicate).to receive(:execute).with("printf \"#{path}\"")
|
expect(machine.communicate).to receive(:execute).with("printf #{path_with_spaces}")
|
||||||
cap.shell_expand_guest_path(machine, path)
|
cap.shell_expand_guest_path(machine, path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,11 +33,12 @@ describe "VagrantPlugins::GuestFreeBSD::Cap::ShellExpandGuestPath" do
|
||||||
|
|
||||||
it "returns a path with a space in it" do
|
it "returns a path with a space in it" do
|
||||||
path = "/home/vagrant folder/folder"
|
path = "/home/vagrant folder/folder"
|
||||||
|
path_with_spaces = "/home/vagrant\\ folder/folder"
|
||||||
allow(machine.communicate).to receive(:execute).
|
allow(machine.communicate).to receive(:execute).
|
||||||
with(any_args).and_yield(:stdout, "/home/vagrant folder/folder")
|
with(any_args).and_yield(:stdout, path_with_spaces)
|
||||||
|
|
||||||
expect(machine.communicate).to receive(:execute)
|
expect(machine.communicate).to receive(:execute)
|
||||||
.with("printf \"#{path}\"", {:shell=>"sh"})
|
.with("printf #{path_with_spaces}", {:shell=>"sh"})
|
||||||
cap.shell_expand_guest_path(machine, path)
|
cap.shell_expand_guest_path(machine, path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,10 +33,11 @@ describe "VagrantPlugins::GuestLinux::Cap::ShellExpandGuestPath" do
|
||||||
|
|
||||||
it "returns a path with a space in it" do
|
it "returns a path with a space in it" do
|
||||||
path = "/home/vagrant folder/folder"
|
path = "/home/vagrant folder/folder"
|
||||||
|
path_with_spaces = "/home/vagrant\\ folder/folder"
|
||||||
allow(machine.communicate).to receive(:execute).
|
allow(machine.communicate).to receive(:execute).
|
||||||
with(any_args).and_yield(:stdout, "/home/vagrant folder/folder")
|
with(any_args).and_yield(:stdout, path_with_spaces)
|
||||||
|
|
||||||
expect(machine.communicate).to receive(:execute).with("echo; printf \"#{path}\"")
|
expect(machine.communicate).to receive(:execute).with("echo; printf #{path_with_spaces}")
|
||||||
cap.shell_expand_guest_path(machine, path)
|
cap.shell_expand_guest_path(machine, path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,10 +33,11 @@ describe "VagrantPlugins::GuestNetBSD::Cap::ShellExpandGuestPath" do
|
||||||
|
|
||||||
it "returns a path with a space in it" do
|
it "returns a path with a space in it" do
|
||||||
path = "/home/vagrant folder/folder"
|
path = "/home/vagrant folder/folder"
|
||||||
|
path_with_spaces = "/home/vagrant\\ folder/folder"
|
||||||
allow(machine.communicate).to receive(:execute).
|
allow(machine.communicate).to receive(:execute).
|
||||||
with(any_args).and_yield(:stdout, "/home/vagrant folder/folder")
|
with(any_args).and_yield(:stdout, path_with_spaces)
|
||||||
|
|
||||||
expect(machine.communicate).to receive(:execute).with("printf \"#{path}\"")
|
expect(machine.communicate).to receive(:execute).with("printf #{path_with_spaces}")
|
||||||
cap.shell_expand_guest_path(machine, path)
|
cap.shell_expand_guest_path(machine, path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,10 +33,11 @@ describe "VagrantPlugins::GuestOpenBSD::Cap::ShellExpandGuestPath" do
|
||||||
|
|
||||||
it "returns a path with a space in it" do
|
it "returns a path with a space in it" do
|
||||||
path = "/home/vagrant folder/folder"
|
path = "/home/vagrant folder/folder"
|
||||||
|
path_with_spaces = "/home/vagrant\\ folder/folder"
|
||||||
allow(machine.communicate).to receive(:execute).
|
allow(machine.communicate).to receive(:execute).
|
||||||
with(any_args).and_yield(:stdout, "/home/vagrant folder/folder")
|
with(any_args).and_yield(:stdout, path_with_spaces)
|
||||||
|
|
||||||
expect(machine.communicate).to receive(:execute).with("printf \"#{path}\"")
|
expect(machine.communicate).to receive(:execute).with("printf #{path_with_spaces}")
|
||||||
cap.shell_expand_guest_path(machine, path)
|
cap.shell_expand_guest_path(machine, path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue