Class: DeviceAPI::IOS::IDeviceDebug

Inherits:
Execution
  • Object
show all
Defined in:
lib/device_api/ios/idevicedebug.rb

Overview

Namespace for all methods encapsulating idevice calls

Class Method Summary collapse

Class Method Details

.run(options = {}) ⇒ Hash

idevicedebug doesn’t return until the app you are attempting to run exits. By passing in a timeout value we can limit how long we wait before terminating the debug session

Parameters:

  • options (Hash) (defaults to: {})

    options for debug running

Options Hash (options):

  • :serial (String)

    serial of the device run

  • :bundle_id (String)

    ID of the app to run

  • :timeout (Integer)

    Number of seconds before the debug session should be killed

Returns:

  • (Hash)

    Returns the stdout of the debug session

Raises:



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/device_api/ios/idevicedebug.rb', line 16

def self.run(options = {})
  serial = options[:serial]
  bundle_id = options[:bundle_id]
  timeout = options[:timeout] || 10

  result = execute("doalarm () { perl -e 'alarm shift; exec @ARGV' \"$@\"; }; doalarm #{timeout} idevicedebug -u #{serial} -d run #{bundle_id}")

  raise IDeviceDebugError.new(result.stderr) unless [0, 255, 142].include?(result.exit)

  result.stdout.split("\r\n")
end