Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Never stop a job by the name of a file Peel couldn't read
Țugui Dragoș249372674910
diff --git a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItemActions.swift b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItemActions.swiftindex a5c2a650..138fe261 100644--- a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItemActions.swift+++ b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItemActions.swift@@ -133,8 +133,10 @@ public enum BackgroundItemActions {}let result = await trash.trash([plist], usingHelperFor: item.removalRequiresPrivileges ? [plist] : [])// `TrashService` stops a job only when `PrivilegedPathPolicy.isValidLabel` accepts its label. The user- // chose this job, so it is also stopped here by its own label.- guard !result.trashed.isEmpty, item.state != .notLoaded else { return Moved(result: result, stillRunning: nil) }+ // chose this job, so it is also stopped here by its own label; a row named by its file has none Peel read.+ guard !result.trashed.isEmpty, item.state != .notLoaded, !item.isNamedByItsFile else {+ return Moved(result: result, stillRunning: nil)+ }return Moved(result: result, stillRunning: await stop(item))}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swiftindex 297ba113..309c0ce1 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift@@ -546,6 +546,16 @@ struct BackgroundItemActionsTests {stop: stop)#expect(steps.withLock { $0 } == ["move"])++ // A row named by its file has no label Peel read, and a job under that name may run from another file.+ steps.withLock { $0 = [] }+ var named = item(.userLibrary, state: .unknown, plist: plist)+ named.isClosedToPeel = true+ named.isNamedByItsFile = true+ _ = try await BackgroundItemActions.moveToTrash(+ named, isHelperEnabled: false, trash: service(refusing: false), stop: stop+ )+ #expect(steps.withLock { $0 } == ["move"])}/// Once its file is in the Trash nothing loads the job again, but one launchd could not stop runs until the Macdiff --git a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swiftindex 8c17c69b..1229af7b 100644--- a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift+++ b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift@@ -494,9 +494,10 @@ extension BackgroundItem {return "\(ownerName) uses it to run in the background, and may stop working until you put it back."}- /// What the question before a move says becomes of the job once its file is in the Trash.+ /// What the question before a move says becomes of the job once its file is in the Trash. A row named by its file+ /// has no label Peel read, so nothing is stopped for it.var whenTrashed: LocalizedStringResource {- guard canBeControlled || state == .notLoaded else {+ guard canBeControlled && !isNamedByItsFile || state == .notLoaded else {return "macOS won’t start it again: it stops for good when the Mac restarts."}// An agent in `/Library/LaunchAgents` runs in every account logged in, and Stop reaches only this one.diff --git a/PeelTests/BackgroundItemTrashWordsTests.swift b/PeelTests/BackgroundItemTrashWordsTests.swiftindex dcd02fba..b36b6fc6 100644--- a/PeelTests/BackgroundItemTrashWordsTests.swift+++ b/PeelTests/BackgroundItemTrashWordsTests.swift@@ -16,4 +16,13 @@ struct BackgroundItemTrashWordsTests {#expect(String(localized: job(.systemLibrary).whenTrashed) == String(localized: "Once the file is in the Trash, the item is stopped for you. Other accounts logged in now run it until they log out, and none starts it again."))#expect(String(localized: job(.userLibrary).whenTrashed) == String(localized: "Once the file is in the Trash, the item is stopped."))}++ @Test func promisesNoStopForARowNamedByItsFile() {+ var named = job(.userLibrary)+ named.state = .unknown+ named.isClosedToPeel = true+ named.isNamedByItsFile = true++ #expect(String(localized: named.whenTrashed) == String(localized: "macOS won’t start it again: it stops for good when the Mac restarts."))+ }}