Commit 5b68d785 authored by Boris Bügling's avatar Boris Bügling

[Executable] Also support " by using `shellescape`

parent 116df746
...@@ -52,8 +52,9 @@ module Pod ...@@ -52,8 +52,9 @@ module Pod
raise Informative, "Unable to locate the executable `#{executable}`" if bin.empty? raise Informative, "Unable to locate the executable `#{executable}`" if bin.empty?
require 'open4' require 'open4'
require 'shellwords'
full_command = "\"#{bin}\" #{command}" full_command = "#{bin.shellescape} #{command}"
if Config.instance.verbose? if Config.instance.verbose?
UI.message("$ #{full_command}") UI.message("$ #{full_command}")
......
...@@ -11,12 +11,12 @@ module Pod ...@@ -11,12 +11,12 @@ module Pod
end end
it 'should support spaces in the full path of the command' do it 'should support spaces in the full path of the command' do
cmd = '/Spa ces/are/fun/false' cmd = '/Spa ces/are"/fun/false'
Executable.stubs(:`).returns(cmd) Executable.stubs(:`).returns(cmd)
result = mock result = mock
result.stubs(:success?).returns(true) result.stubs(:success?).returns(true)
Open4.expects(:spawn).with("\"#{cmd}\" ", :stdout => [], :stderr => [], :status => true).once.returns(result) Open4.expects(:spawn).with('/Spa\\ ces/are\\"/fun/false ', :stdout => [], :stderr => [], :status => true).once.returns(result)
Executable.execute_command(cmd, '', true) Executable.execute_command(cmd, '', true)
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment