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 committed by Franz Pletz
parent ea99d13f76
commit 993e430ccc
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