Method: PSWindows::Exec#get_env_var
- Defined in:
- lib/beaker/host/pswindows/exec.rb
#get_env_var(key, clean = false) ⇒ Object
Return the value of a specific env var
153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/beaker/host/pswindows/exec.rb', line 153 def get_env_var key, clean = false self.close # refresh the state key = key.to_s.upcase val = exec(Beaker::Command.new("set #{key}"), :accept_all_exit_codes => true).stdout.chomp return '' if val.empty? val = val.split("\n")[0] # only take the first result if clean val.gsub(/#{key}=/i, '') else val end end |