-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
call_on_close should work with async #16
Comments
Basically your |
Thanks for the report, I'll look into handling this. |
Had any change to dig into this one? I could make a PR for you but new sure which is your latest branch. Pypi says 8.0.1.3 but there is no such branch/tag in this repo. |
Now I see the 8.0.1.3 tag, missed it. Would you like a PR or can you make the 3 lines of code change. Suppose I could also fork if needed, but I really hate doing that to a project for 3 lines of code :) |
Looking at the 8.x code its quite different that the 7.x code this issue was opened for. My suggested fix above is definitely not correct for 8.x. But I can verify call_on_close still does not handle async callbacks as I believe it should be able to handle either async or sync. |
A PR would be useful, I'm somewhat swamped with $DAY_JOB until the end of next week at least. |
My fix is for your 7.x version. You could at least take that and put out a 7.1.2.4 so those that rely on 7.x will have this fix. But the 8.x branch is quite different, I don't have a PR for that. I'll stick on 7.x for the foreseeable future. I notice you don't have a 7.1.2.3 tag on github by pypi shows 7.1.2.3. I assume the PR would be from the 7.1.2.2+async tag? |
OK so I planned to look into this but I have no idea any more what the problem is. If you have a complete piece of example code how to trigger the problem that'd be helpful. |
Trying to fire an event when a command is finished. I currently use
Which works fine except for when there is no actual command. In other words just running click without command or params to show help output for example.
I need to run code at the end of command including no command which shows help output. I found that click has
call_on_close
where you can pass in a callback function which does indeed get called at the end of every command even NO command that just shows the help output.But asyncclick does not handle that callback as
await
. So I can only have synchronous methods. I need the callbacks to be awaited so I can call other shutdown code that must also be awaited.The text was updated successfully, but these errors were encountered: