The implementation of async custom completions using DispatchSemaphore from #782 worked for me in the past, but async custom completions are hanging for me now, presumably due to deadlocks.
I don't know what caused the difference in behavior. I don't know if the hangs:
- always existed under certain circumstances (& my current code is experiencing them while my older code didn't)
- are caused by subsequent modifications to the async custom completion implementation
- are caused by a newer Swift compiler, Swift runtime, and/or macOS
- etc.
I'll try to whittle down a concise hang & non-hang examples in the future.
I have a local branch that fixes this that I can submit as a PR; it replaces DispatchSemaphore with async/await all the way down, so it only works for AsyncParsableCommand.
I can reinstate the DispatchSemaphore implementation in place for ParsableCommand if it still works for some async custom completions, or remove it if it no longer works at all (my current local branch does the latter, since it was simpler to investigate & implement that way, but it shouldn't be hard to reinstate the DispatchSemaphore implementation).
I'll investigated more (& potentially get feedback here), provide examples, clean up my local branch, and submit it as a PR.
ArgumentParser version:
main
Swift version:
swift-driver version: 1.127.14.1 Apple Swift version 6.2.3 (swiftlang-6.2.3.3.21 clang-1700.6.3.2)
Target: arm64-apple-macosx26.0
Checklist
Steps to Reproduce
Will provide a concise example in the future.
Expected behavior
Async custom completion returns instead of hanging.
Actual behavior
Async custom completion hangs instead of returning.
The implementation of async custom completions using
DispatchSemaphorefrom #782 worked for me in the past, but async custom completions are hanging for me now, presumably due to deadlocks.I don't know what caused the difference in behavior. I don't know if the hangs:
I'll try to whittle down a concise hang & non-hang examples in the future.
I have a local branch that fixes this that I can submit as a PR; it replaces
DispatchSemaphorewithasync/awaitall the way down, so it only works forAsyncParsableCommand.I can reinstate the
DispatchSemaphoreimplementation in place forParsableCommandif it still works for some async custom completions, or remove it if it no longer works at all (my current local branch does the latter, since it was simpler to investigate & implement that way, but it shouldn't be hard to reinstate theDispatchSemaphoreimplementation).I'll investigated more (& potentially get feedback here), provide examples, clean up my local branch, and submit it as a PR.
ArgumentParser version:
main
Swift version:
swift-driver version: 1.127.14.1 Apple Swift version 6.2.3 (swiftlang-6.2.3.3.21 clang-1700.6.3.2)
Target: arm64-apple-macosx26.0
Checklist
mainbranch of this packageSteps to Reproduce
Will provide a concise example in the future.
Expected behavior
Async custom completion returns instead of hanging.
Actual behavior
Async custom completion hangs instead of returning.