phoneTerminate function
Stops bundleId on the phone udid; null when it stopped or was not running, else why not.
Implementation
Future<String?> phoneTerminate(String udid, String bundleId) async {
final pids = await phoneAppPids(udid, bundleId);
for (final pid in pids) {
final r = await runBounded(
'xcrun',
['devicectl', 'device', 'process', 'terminate', '--device', udid, '--pid', '$pid', '--kill', '-q'],
timeout: const Duration(seconds: 30),
phase: 'devicectl terminate',
);
if (r.exitCode != 0) return '${r.stderr}'.trim().split('\n').last;
}
return null;
}