Method: MacWifi::BaseModel#run_os_command

Defined in:
lib/mac-wifi/base_model.rb

#run_os_command(command) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/mac-wifi/base_model.rb', line 25

def run_os_command(command)
  output = `#{command} 2>&1` # join stderr with stdout
  if $?.exitstatus != 0
    raise OsCommandError.new($?.exitstatus, command, output)
  end
  if @verbose_mode
    puts "\n\n#{'-' * 79}\nCommand: #{command}\n\nOutput:\n#{output}#{'-' * 79}\n\n"
  end
  output
end