Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

recovery: a failed winetricks step names the verbs and says why it fails, not '/bin/bash didn't finish' (#135)

Gauthier Piarrette610b72711024
diff --git a/Sources/HighballKit/Recovery.swift b/Sources/HighballKit/Recovery.swift
index 195ffbe..c1da751 100644
--- a/Sources/HighballKit/Recovery.swift
+++ b/Sources/HighballKit/Recovery.swift
@@ -53,6 +53,15 @@ public struct Recovery: Equatable, Sendable {
return Recovery(headline: "The Windows environment didn't finish setting up.",
meaning: "Highball can run the setup again.",
actionTitle: "Repair", action: .repairBottle)
+ case let .processFailed(command, _, _) where command.contains("winetricks"):
+ // The command is "/bin/bash <winetricks> --unattended <verbs>": naming bash helps
+ // nobody (highball#135 read "/bin/bash didn't finish" and offered a fresh download).
+ let words = command.split(separator: " ").map(String.init)
+ let verbs = words.drop(while: { $0 != "--unattended" }).dropFirst().joined(separator: " ")
+ let what = verbs.isEmpty ? "The winetricks step" : "Installing \(verbs) with winetricks"
+ return Recovery(headline: "\(what) didn't finish.",
+ meaning: "It downloads its files from the internet as it runs, and those servers refuse now and then, so trying again in a few minutes often works. Details has the reason it gave.",
+ actionTitle: "Try again", action: .retry)
case let .processFailed(command, _, _):
let name = command.split(separator: " ").first.map(String.init) ?? "The installer"
return Recovery(headline: "\(name) didn't finish.",
diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swift
index 47351e1..1ea41e3 100644
--- a/Tests/HighballKitTests/RegressionTests.swift
+++ b/Tests/HighballKitTests/RegressionTests.swift
@@ -1118,6 +1118,10 @@ extension RegressionTests {
XCTAssertFalse(boot.headline.contains("1") || boot.meaning.contains("/tmp"), "no exit codes or paths")
let installer = Recovery.describe(HighballError.processFailed(command: "VC_redist.x64.exe /install", status: 3010, output: ""))
XCTAssertEqual(installer.action, .retry); XCTAssertTrue(installer.headline.hasPrefix("VC_redist.x64.exe"))
+ let tricks = Recovery.describe(HighballError.processFailed(command: "/bin/bash /e/tools/winetricks --unattended corefonts", status: 1, output: ""))
+ XCTAssertEqual(tricks.action, .retry)
+ XCTAssertEqual(tricks.headline, "Installing corefonts with winetricks didn't finish.", "not '/bin/bash didn't finish' (highball#135)")
+ XCTAssertFalse(tricks.meaning.contains("fresh copy"))
let wow = Recovery.describe(HighballError.invalid("Windows 32-bit support couldn't be set up in this bottle"))
XCTAssertEqual(wow.action, .repairBottle)
let net = Recovery.describe(URLError(.timedOut))