Skip to content

Commit dbe090e

Browse files
committed
Move autoremove command to not block UI
1 parent 057e8fc commit dbe090e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Pearcleaner/Logic/Brew/HomebrewController.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,12 +1259,14 @@ class HomebrewController {
12591259
}
12601260

12611261
func performFullCleanup() async throws {
1262-
// Run autoremove first to remove orphaned dependencies
1263-
let autoremoveArgs = ["autoremove"]
1264-
_ = try await runBrewCommand(autoremoveArgs)
1265-
1266-
// Then clean up cache and logs directly (same as runCleanup)
1262+
// Fast operation: delete cache and logs to Trash (blocks UI briefly ~50ms)
12671263
try await runCleanup()
1264+
1265+
// Slow operation: run brew autoremove in background without blocking UI
1266+
Task.detached(priority: .background) {
1267+
let autoremoveArgs = ["autoremove"]
1268+
_ = try? await HomebrewController.shared.runBrewCommand(autoremoveArgs)
1269+
}
12681270
}
12691271

12701272
func getAnalyticsStatus() async throws -> Bool {

0 commit comments

Comments
 (0)