Resolve $HOME even if VM spits bogus new lines

Fixes issue #122
This commit is contained in:
David Schoen 2014-09-28 16:03:51 +10:00
parent b2b0d98dfa
commit e9f4df338a

View file

@ -7,8 +7,11 @@ module VagrantPlugins
composer_path = nil
machine.communicate.tap do |comm|
return unless comm.test('which php')
# on some VMs an extra new line seems to come out, so we loop over
# the output just in case
composer_path = ''
comm.execute 'echo $HOME' do |buffer, output|
composer_path = output.chomp if buffer == :stdout
composer_path += output.chomp if buffer == :stdout
end
end
return "#{composer_path}/.composer/cache"