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:
parent
ea99d13f76
commit
993e430ccc
2 changed files with 2 additions and 2 deletions
|
@ -36,7 +36,7 @@ module Vagrant
|
||||||
|
|
||||||
def ensure_lxc_installed!
|
def ensure_lxc_installed!
|
||||||
begin
|
begin
|
||||||
sudo_wrapper.run("/usr/bin/which", "lxc-create")
|
sudo_wrapper.run("which", "lxc-create")
|
||||||
rescue Vagrant::LXC::Errors::ExecuteError
|
rescue Vagrant::LXC::Errors::ExecuteError
|
||||||
raise Errors::LxcNotInstalled
|
raise Errors::LxcNotInstalled
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Vagrant
|
||||||
def run(*command)
|
def run(*command)
|
||||||
options = command.last.is_a?(Hash) ? command.last : {}
|
options = command.last.is_a?(Hash) ? command.last : {}
|
||||||
command.unshift @wrapper_path if @wrapper_path && !options[:no_wrapper]
|
command.unshift @wrapper_path if @wrapper_path && !options[:no_wrapper]
|
||||||
execute *(['sudo'] + command)
|
execute *(['sudo', '/usr/bin/env'] + command)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in a new issue