Method: DeviceAPI::Android::ADB.shell

Defined in:
lib/device_api/android/adb.rb

.shell(qualifier, command) ⇒ Object

ADB Shell command

Parameters:

  • qualifier (String)

    qualifier of device

  • command (String)

    command to execute



304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/device_api/android/adb.rb', line 304

def self.shell(qualifier, command)
  result = execute("adb -s '#{qualifier}' shell #{command}")
  case result.stderr
  when /^error: device unauthorized./
    raise DeviceAPI::UnauthorizedDevice, result.stderr
  when /^error: device not found/
    raise DeviceAPI::DeviceNotFound, result.stderr
  else
    raise ADBCommandError.new(result.stderr)
  end if result.exit != 0

  result
end