-
Notifications
You must be signed in to change notification settings - Fork 73
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
Introduce deinit hook #1263
Comments
@Oscaner why do you need to use a hook? If you have a command that's chaining other commands, couldn't you just execute your "deinit" code at the end? This is what I'm imagining class MyCommand extends Command {
run() {
// run "command one"
await this.config.runCommand('command:one')
// run "command two"
await this.config.runCommand('command:two')
// final logic here
}
} |
For example, I init the Puppeteer browser in "init" hook, and cached the Browser in LRU-cache to globally reuse in every commands. I don't want remove the Browser in every commands (this is why I cannot use "postrun" hook), So I need "deinit" hook, just run once when command finished, even if this command contains multiple commands or not. For another example, put some temporary files in local, and remove them when chain command finished, or independent command finished. Thanks. |
Is your feature request related to a problem? Please describe.
I have a command to chain sub-commands, and I just want to run final postrun hook, but cannot.
Workflow:
-> [hook] init
-> [hook] prerun
-> [command] main
----> [hook] prerun
----> [command] sub1
----> [hook] postrun
----> [hook] prerun
----> [command] sub2
----> [hook] postrun
----> ...
-> [hook] postrun
-> [hook] deinit
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: