Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ControlRoom/Controllers/SimCtl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ enum SimCtl: CommandLineCommandExecuter {
}

static func boot(_ simulator: Simulator) {
execute(.boot(simulator: simulator))
/// No need to check if Simulator app is already running since no second SImulator app will be spawned
SnapshotCtl.startSimulatorApp {
/// Wait for a little while Simulator app starts running, then proceed to boot simulator
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
execute(.boot(simulator: simulator))
}
}
}

static func shutdown(_ simulator: String, completion: ((Result<Data, CommandLineError>) -> Void)? = nil) {
Expand Down
4 changes: 4 additions & 0 deletions ControlRoom/Controllers/SnapshotCtl+Commands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ extension SnapshotCtl {
Command("/bin/mkdir", arguments:["-p", "\(devicesPath)/\(snapshotsFolder)/\(deviceId)/\(snapshotName)"])
}

/// Open app
static func open(app: String) -> Command {
Command("/usr/bin/open", arguments: ["-a", app])
}
}

}
8 changes: 7 additions & 1 deletion ControlRoom/Controllers/SnapshotCtl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,16 @@ enum SnapshotCtl: CommandLineCommandExecuter {
}
}

static func startSimulatorApp(completion: @escaping (() -> Void)) {
execute(.open(app: "Simulator.app")) { _ in
return completion()
}
}

private static func getSnapshotAttributes(_ snapshotPath: String) -> URLFileAttribute {
let snapshotURL: URL = URL(fileURLWithPath: snapshotPath)
let snapshotAttributes = URLFileAttribute(url: snapshotURL)
return snapshotAttributes
}

}