mirror of
https://github.com/kfattic/cupsadmin.git
synced 2026-11-13 19:06:43 -05:00
Delete Printer: a queue that's already gone is a successful delete
Judge the delete by the read-back (is the queue gone?) instead of lpadmin's exit status. Deleting a queue that was removed elsewhere before the sidebar refreshed made lpadmin fail with 'The printer or class does not exist', and the app showed a failure alert although the queue was gone. Now the status bar shows 'Deleted <queue>' and os_log notes it was already deleted. Unit tests for all four outcomes, plus an opt-in live test (CUPSKIT_LIVE_DELETE=1) on a name that never existed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -251,7 +251,7 @@ final class PrinterStore {
|
||||
deleted = outcome.succeeded
|
||||
if deleted {
|
||||
report("Deleted \(queue) in \(elapsedText(since: started))")
|
||||
log.info("deleted \(queue, privacy: .public)")
|
||||
log.info("deleted \(queue, privacy: .public)\(outcome.message.map { " (\($0))" } ?? "", privacy: .public)")
|
||||
} else {
|
||||
report("ERROR: delete \(queue): \(outcome.message ?? "failed")")
|
||||
fail("Couldn’t delete \(queue)", "\(outcome.message ?? "failed")\n\n\(outcome.command)")
|
||||
|
||||
Reference in New Issue
Block a user