From e9f4df338a5be86ce4428a0abc338fbc5dcd02ba Mon Sep 17 00:00:00 2001 From: David Schoen Date: Sun, 28 Sep 2014 16:03:51 +1000 Subject: [PATCH] Resolve $HOME even if VM spits bogus new lines Fixes issue #122 --- lib/vagrant-cachier/cap/linux/composer_path.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-cachier/cap/linux/composer_path.rb b/lib/vagrant-cachier/cap/linux/composer_path.rb index d1e47ac..ede4bb5 100644 --- a/lib/vagrant-cachier/cap/linux/composer_path.rb +++ b/lib/vagrant-cachier/cap/linux/composer_path.rb @@ -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"