Use /usr/bin/env CMD instead of hardcoded paths

This fixes commands that currently rely on hardcoded paths and break
on systems like NixOS that don't have all binaries in /usr/bin etc.
This commit is contained in:
Robin Gloster 2015-08-02 10:13:40 +00:00
parent 9c67e13fb8
commit 4b78c04a47
2 changed files with 2 additions and 2 deletions

View file

@ -36,7 +36,7 @@ module Vagrant
def ensure_lxc_installed!
begin
sudo_wrapper.run("/usr/bin/which", "lxc-create")
sudo_wrapper.run("which", "lxc-create")
rescue Vagrant::LXC::Errors::ExecuteError
raise Errors::LxcNotInstalled
end

View file

@ -14,7 +14,7 @@ module Vagrant
def run(*command)
options = command.last.is_a?(Hash) ? command.last : {}
command.unshift @wrapper_path if @wrapper_path && !options[:no_wrapper]
execute *(['sudo'] + command)
execute *(['sudo', '/usr/bin/env'] + command)
end
private