class Fastlane::Actions::QuitCoreSimulatorServiceAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb, line 30
def self.authors
  ["lyndsey-ferguson/@lyndseydf"]
end
category() click to toggle source
# File lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb, line 34
def self.category
  :testing
end
description() click to toggle source

:nocov:

# 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
details() click to toggle source
# 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) click to toggle source
# File lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb, line 38
def self.is_supported?(platform)
  platform == :ios
end
run(params) click to toggle source
# 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