Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
A failed Epic install or uninstall shows legendary's last lines in Details. The error said "epic install exited with 1, see the log above", and Details showed only that sentence, never legendary's output (highball-db#961). LegendaryTail keeps the last 30 lines of a run, without the download manager's progress block, and the three failures that said "see the log above" carry them. A failure installFailure turns into a sentence is unchanged. EpicStoreTests pass.
Gauthier Piarrette4a91e88a0c34
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex 378380e..75b5bc1 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -3635,6 +3635,7 @@ final class AppState {epicDownloadTotal = nillet refused = OSAllocatedUnfairLock(initialState: false)let failure = OSAllocatedUnfairLock<String?>(initialState: nil)+ let tail = LegendaryTail()// What changes in an environment's game folder while legendary installs or updates// it is legendary's, not saves (EpicSaves.historyFile).let start = Date()@@ -3650,6 +3651,7 @@ final class AppState {try install(store, control) { line inif EpicStore.refusedForLock(line) { refused.withLock { $0 = true } }if let why = EpicStore.installFailure(line) { failure.withLock { if $0 == nil { $0 = why } } }+ tail.append(line)Task { @MainActor in self.appendLog(line); self.reportEpicDownload(line) }}}.value@@ -3665,7 +3667,7 @@ final class AppState {}guard status == 0 else {if let why = failure.withLock({ $0 }) { throw HighballError.failed(why) }- throw HighballError.processFailed(command: "epic install", status: status, output: "see the log above")+ throw HighballError.processFailed(command: "epic install", status: status, output: tail.text)}}if let wrap { try await wrap(download) } else { try await download() }@@ -3709,9 +3711,10 @@ final class AppState {/// Removes an Epic game's installed build through legendary (one per game), its lines in the log.private func legendaryUninstall(_ app: String) async throws {let store = epicStore- let log: @Sendable (String) -> Void = { line in Task { @MainActor in self.appendLog(line) } }+ let tail = LegendaryTail()+ let log: @Sendable (String) -> Void = { line in tail.append(line); Task { @MainActor in self.appendLog(line) } }let status: Int32 = try await Task.detached { try store.uninstall(app, onLine: log) }.value- guard status == 0 else { throw HighballError.processFailed(command: "legendary uninstall", status: status, output: "see the log above") }+ guard status == 0 else { throw HighballError.processFailed(command: "legendary uninstall", status: status, output: tail.text) }}/// Replaces an Epic game's Mac build with the Windows one in the default environment@@ -3776,10 +3779,11 @@ final class AppState {dropOldRecord: oldPath.map { _ in { [self] instage = removingtry await Task.detached { try store.saveRecord(app) }.value- let status = try await Task.detached { try store.forgetRecordKeepingFiles(app, onLine: log) }.value+ let tail = LegendaryTail()+ let status = try await Task.detached { try store.forgetRecordKeepingFiles(app, onLine: { tail.append($0); log($0) }) }.valueguard status == 0 else {_ = try? await Task.detached { try store.restoreSavedRecord(app) }.value- throw HighballError.processFailed(command: "legendary uninstall --keep-files", status: status, output: "see the log above")+ throw HighballError.processFailed(command: "legendary uninstall --keep-files", status: status, output: tail.text)}// legendary exits 0 without touching its records when another legendary holds// its lock: the switch goes on only once the record is really gone.diff --git a/Sources/HighballKit/EpicStore.swift b/Sources/HighballKit/EpicStore.swiftindex b07caa2..317f461 100644--- a/Sources/HighballKit/EpicStore.swift+++ b/Sources/HighballKit/EpicStore.swift@@ -462,6 +462,31 @@ public struct EpicStore: Sendable {}}+/// The last lines a legendary run printed, for the Details of a failure none of them explains+/// (EpicStore.installFailure). The error said "see the log above" and its Details showed only+/// that, never legendary's output (highball-db#961, an install that exited with 1). The download+/// manager's progress block, several lines a second, stays out.+public final class LegendaryTail: @unchecked Sendable {+ private let lock = NSLock()+ private var lines: [String] = []+ private let limit: Int++ public init(limit: Int = 30) { self.limit = limit }++ public func append(_ line: String) {+ guard !line.contains("[DLManager] INFO:"), !line.trimmingCharacters(in: .whitespaces).isEmpty else { return }+ lock.withLock {+ lines.append(line)+ if lines.count > limit { lines.removeFirst(lines.count - limit) }+ }+ }++ public var text: String {+ let lines = lock.withLock { self.lines }+ return lines.isEmpty ? "legendary printed nothing" : "legendary's last lines:\n" + lines.joined(separator: "\n")+ }+}+/// Stops a running legendary the way Ctrl-C in a terminal does. A terminal signals the whole/// process group, and legendary's downloader runs in child processes, so SIGINT goes to/// legendary and everything it started. legendary answers by keeping the download's progress,diff --git a/Tests/HighballKitTests/EpicStoreTests.swift b/Tests/HighballKitTests/EpicStoreTests.swiftindex f839106..96e12cf 100644--- a/Tests/HighballKitTests/EpicStoreTests.swift+++ b/Tests/HighballKitTests/EpicStoreTests.swift@@ -12,6 +12,23 @@ final class EpicStoreTests: XCTestCase {XCTAssertNil(EpicStore.installFailure("[cli] INFO: Download size: 95232.19 MiB (Compression savings: 2.1%)"))}+ /// highball-db#961: an install that exited with 1 and no sentence showed "see the log above" in Details,+ /// and no log. Details now carries legendary's last lines, without the download manager's progress.+ func testAFailureNoSentenceExplainsKeepsLegendarysLastLines() {+ let tail = LegendaryTail(limit: 3)+ XCTAssertEqual(tail.text, "legendary printed nothing")+ for line in ["[cli] INFO: Preparing download for \"Gamename\"...",+ "[DLManager] INFO: = Progress: 10.07% (10035/99671), Running for 00:06:22, ETA: 00:56:57",+ "",+ "[cli] INFO: Install path: C:\\Games\\Gamename",+ "[Core] WARNING: Parsing manifest failed",+ "Traceback (most recent call last):",+ "KeyError: 'files'"] {+ tail.append(line)+ }+ XCTAssertEqual(tail.text, "legendary's last lines:\n[Core] WARNING: Parsing manifest failed\nTraceback (most recent call last):\nKeyError: 'files'")+ }+/// Legendary has no terminal under Highball: the selective-download prompt (optional/// language packs) raised EOFError and killed the install (#110). `-y` alone does not skip it./// legendary's lines as a GTA V Enhanced install printed them (highball#287): the size once,