Modern Apps git

← xtool.git

Better cancellation handling

Commit
7ff1c0826aad7b43d570ca6506d4f90e8064af73
Author
Kabir Oberai <[email protected]>
When
2024-12-15 15:21 UTC (1 year ago)
Parents
c009ba5

Diff

Sources/SupersignCLISupport/ConnectionOptions.swift
diff --git a/Sources/SupersignCLISupport/ConnectionOptions.swift b/Sources/SupersignCLISupport/ConnectionOptions.swiftindex a186680..830c8ff 100644--- a/Sources/SupersignCLISupport/ConnectionOptions.swift+++ b/Sources/SupersignCLISupport/ConnectionOptions.swift@@ -30,13 +30,13 @@ extension ConnectionOptions.WithoutSearchMode {             } else {                 return try Console.choose(                     from: devices,-                    onNoElement: { throw ValidationError("Device not found") },+                    onNoElement: { throw Console.Error("Device not found") },                     multiPrompt: "Choose device",                     formatter: { "\($0.deviceName) (\($0.connectionType), udid: \($0.udid))" }                 )             }         } -        throw ValidationError("Device not found")+        throw CancellationError()     } }
Sources/SupersignCLISupport/SupersignCommand.swift
diff --git a/Sources/SupersignCLISupport/SupersignCommand.swift b/Sources/SupersignCLISupport/SupersignCommand.swiftindex 6bee11d..e937fed 100644--- a/Sources/SupersignCLISupport/SupersignCommand.swift+++ b/Sources/SupersignCLISupport/SupersignCommand.swift@@ -56,7 +56,8 @@ extension ParsableCommand {                 } else {                     try command.run()                 }-            } catch is CancellationError {+            } catch where error is CancellationError || Task.isCancelled {+                print("Cancelled.")                 self.exit()             } catch {                 self.exit(withError: error)