From a31f44ebfbd15a2cc0fda705279676773ac16355 Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Wed, 10 Jan 2024 11:45:52 -0600 Subject: [PATCH] Revert unnecessary command behavior change (#197) Revert this unnecessary and ill-advised behavior change. --- Sources/ConsoleKitCommands/Base/AnyCommand.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sources/ConsoleKitCommands/Base/AnyCommand.swift b/Sources/ConsoleKitCommands/Base/AnyCommand.swift index 9a26eb3..84ab2bb 100644 --- a/Sources/ConsoleKitCommands/Base/AnyCommand.swift +++ b/Sources/ConsoleKitCommands/Base/AnyCommand.swift @@ -25,9 +25,12 @@ extension AnyCommand { "" } + // we need to have a sync environment so the compiler uses the sync run method over the async version + private func syncRun(using context: inout CommandContext) throws { + try self.run(using: &context) + } + public func run(using context: inout CommandContext) async throws { - try await withCheckedThrowingContinuation { continuation in - continuation.resume(with: .init { try self.run(using: &context) }) - } + try self.syncRun(using: &context) } }