Module: VagrantPlugins::ProxyConf::Cap::Util
- Defined in:
- lib/vagrant-proxyconf/cap/util.rb
Overview
Utility methods for capabilities
Class Method Summary collapse
-
.which(machine, cmd) ⇒ Object
Returns path to the command on the machine, or false if it’s not found.
Class Method Details
.which(machine, cmd) ⇒ Object
Returns path to the command on the machine, or false if it’s not found
7 8 9 10 11 12 13 14 15 |
# File 'lib/vagrant-proxyconf/cap/util.rb', line 7 def self.which(machine, cmd) path = false status = machine.communicate.execute( "which #{cmd}", error_check: false) do |type, data| # search for the command to work around `ssh.pty = true` path = data.chomp if type == :stdout && data =~ /#{cmd}$/ end status == 0 && path end |