Skip to content

Commit 9019258

Browse files
authored
fix: apple script integration (#119) (#120)
* fix: apple script integration * fix: parse out crashdata error
1 parent 1213535 commit 9019258

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

MiniSim/Extensions/Thread+Asserts.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import Foundation
22

33
extension Thread {
44
static func assertMainThread() {
5+
#if DEBUG
56
precondition(Thread.isMainThread, "Not on main thread")
7+
#endif
68
}
79

810
static func assertBackgroundThread() {
11+
#if DEBUG
912
precondition(!Thread.isMainThread, "On main thread")
13+
#endif
1014
}
1115
}

MiniSim/Service/DeviceService.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class DeviceService: DeviceServiceProtocol {
3434
attributes: .concurrent
3535
)
3636
private static let deviceBootedError = "Unable to boot device in current state: Booted"
37+
private static let crashDataError = "Storing crashdata"
3738

3839
private static let derivedDataLocation = "~/Library/Developer/Xcode/DerivedData"
3940

@@ -261,6 +262,8 @@ extension DeviceService {
261262
}
262263

263264
static func getIOSDevices() throws -> [Device] {
265+
Thread.assertBackgroundThread()
266+
264267
let output = try shellOut(
265268
to: ProcessPaths.xcrun.rawValue,
266269
arguments: ["simctl", "list", "devices", "available"]
@@ -393,7 +396,7 @@ extension DeviceService {
393396
let splitted = output.components(separatedBy: "\n")
394397

395398
return splitted
396-
.filter { !$0.isEmpty }
399+
.filter { !$0.isEmpty && !$0.contains(crashDataError) }
397400
.map { deviceName in
398401
let adbId = try? ADB.getAdbId(for: deviceName, adbPath: adbPath)
399402
return Device(name: deviceName, identifier: adbId, booted: adbId != nil, platform: .android)

0 commit comments

Comments
 (0)