Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing support for async entry points #192

Open
dimitribouniol opened this issue Feb 2, 2023 · 1 comment
Open

Missing support for async entry points #192

dimitribouniol opened this issue Feb 2, 2023 · 1 comment

Comments

@dimitribouniol
Copy link

It doesn't seem like async entry points work when using swift sh, at least at first glance. I initially noticed this when migrating from ParsableCommand to AsyncParsableCommand, and all of a sudden my command only printed usage information, but never ran. Unfortunately, adding an await to the entry point await YourCommand.main() doesn't work (non-async main() is preferred), though the likely proper solution is to implement something like in #163, but make sure async entry points are supported.

For those that land here, there is a workaround:

let group = DispatchGroup()
group.enter()
Task {
    await YourCommand.main()
    group.leave()
}
group.wait()
@mxcl
Copy link
Owner

mxcl commented Feb 2, 2023

I'm not a Swift guy anymore (sadly). So I missed this update to the language.

Also I haven't time to add it. The codebase isn't too taxing. Testing it locally is quite easy. I hope someone takes this on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants