Class: Fastlane::Actions::QuitCoreSimulatorServiceAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



30
31
32
# File 'lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb', line 30

def self.authors
  ["lyndsey-ferguson/@lyndseydf"]
end

.categoryObject



34
35
36
# File 'lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb', line 34

def self.category
  :testing
end

.descriptionObject

:nocov:



21
22
23
# File 'lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb', line 21

def self.description
  "📲 Force-quits the com.apple.CoreSimulator.CoreSimulatorService to fix mysterious iOS Simulator issues."
end

.detailsObject



25
26
27
28
# File 'lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb', line 25

def self.details
  "Sometimes the com.apple.CoreSimulator.CoreSimulatorService can hang. " \
  "Use this action to force-quit it."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb', line 38

def self.is_supported?(platform)
  platform == :ios
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb', line 4

def self.run(params)
  launchctl_list_count = 0
  commands = []
  while Actions.sh('launchctl list | grep com.apple.CoreSimulator.CoreSimulatorService || true', log: false) != ''
    UI.crash!('Unable to quit com.apple.CoreSimulator.CoreSimulatorService after 10 tries') if (launchctl_list_count += 1) > 10
    commands << Actions.sh('launchctl remove com.apple.CoreSimulator.CoreSimulatorService &> /dev/null || true', log: false)
    UI.verbose('Waiting for com.apple.CoreSimulator.CoreSimulatorService to quit')
    sleep(0.5)
  end
  commands
end