runningApps method

Future<List<String>> runningApps(
  1. String udid
)

Bundle ids of the apps running on udid right now (backgrounded ones too), empty when the list cannot be read.

Implementation

Future<List<String>> runningApps(String udid) async {
  try {
    final r = await runBounded('xcrun', ['simctl', 'spawn', udid, 'launchctl', 'list'],
        timeout: const Duration(seconds: 8), phase: 'simctl launchctl list');
    if (r.exitCode != 0) return const [];
    return {
      for (final m in RegExp(r'UIKitApplication:([^\[\s]+)\[').allMatches(r.stdout.toString())) m.group(1)!,
    }.toList();
  } on Object {
    return const [];
  }
}