Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

Better cancellation handling

Kabir Oberai7ff1c0826aad
diff --git a/Sources/SupersignCLISupport/ConnectionOptions.swift b/Sources/SupersignCLISupport/ConnectionOptions.swift
index 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()
}
}
diff --git a/Sources/SupersignCLISupport/SupersignCommand.swift b/Sources/SupersignCLISupport/SupersignCommand.swift
index 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)