-
Notifications
You must be signed in to change notification settings - Fork 107
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
[Question] Are spinner task groups no longer supported? #157
Comments
@zateutsch It is going to be available on next release, for now you can use |
Hello @zateutsch 👋🏼 This is currently staged for release #149. This feature is somewhat new and is tied #152 but doesn't solve the issue completely. So I am waiting on a response from him. I also wanted to crunch some other bugs before the next release. Thanks, |
@cpreston321 @Mist3rBru Thanks for the speedy answer. As a follow up, is there any way to listen for a cancel during a spinner as it is currently implemented? |
@zateutsch the const s = p.spinner()
s.start('First message')
// do stuff...
process.on('exit', () => {
// handle cancel...
s.stop('Last message')
process.exit(0)
}) |
Thanks for the answers. Closing as resolved. |
FWIW, I learned this leads to a Node.js memory leak warning once you stop 11 spinners (yes, I have a rather complex CLI 😅). I ended up with the following helpers to avoid the warning: function exitProcess() {
process.stdout.write("\n");
process.exit(1);
}
/**
* @see https://github.com/natemoo-re/clack/issues/134#issuecomment-1694564106
*/
export function stopSpinner(s: ReturnType<typeof spinner>, message: string) {
s.stop(message);
process.removeListener("SIGINT", exitProcess);
process.on("SIGINT", exitProcess);
} Update: Just as I posted that, I realized we could just use |
Can't find this from the readme on the latest version of prompts.
The text was updated successfully, but these errors were encountered: