Skip to content

[Bug] When starting a spinner, the process won't stop after your script is done executing. #348

Closed

Description

@ivands

Environment

  • OS: macOS
  • Deno Version: 2.2.4
  • Package: @clack/prompts
  • Package Version: 0.11.0

Describe the bug
When starting a spinner, the node / deno process won't stop after your script is done executing.

To Reproduce
Just start the spinner and stop it.
Your process should never quit on its own from now on.

Expected behavior
Your process should properly stop after stopping the spinner.

Additional Information
It probably has something to do with an event listener that's not being cleaned up properly.

Activity

  1. 43081j commented on Jul 1, 2025

    @43081j
    Collaborator

    do you mean you didn't call stop()?

    this makes sense as there's nothing we can listen for. an exit won't happen because the spinner is still iterating on a timer in the background, so there's no exit event to catch.

    if something forcefully exits, the spinner does stop.

    but you really should call stop()

    its the same as if you had a setInterval running in your code somewhere, it'll never exit if you don't clean it up.

    if you are calling stop, please provide an example as i can't reproduce that

  2. ivands commented on Jul 3, 2025

    @ivands
    Author

    I mean after calling stop

  3. 43081j commented on Jul 3, 2025

    @43081j
    Collaborator

    if you are calling stop, please provide an example as i can't reproduce that

    do you have an example?

    i've tried this locally and it works fine, so i think we will need a reproduction from you

  4. ivands commented on Jul 3, 2025

    @ivands
    Author

    Yeah, so I just tried it on Node and it seems to work.
    But in Deno it will get stuck.

    import { spinner } from '@clack/prompts'
    
    const spin = spinner()
    spin.start('Hello')
    spin.stop('World')

    However, i also had instances where my cli tool running in node would get stuck.
    Just not sure now if the spinner was the problem anymore XD

  5. 43081j commented on Jul 3, 2025

    @43081j
    Collaborator

    i also can't reproduce that in main, so i wonder if its a long gone problem

    can you try out 1.0.0-alpha.1 and see if it still happens? so we at least know if its been fixed in latest

  6. mikkelal commented on Feb 23, 2026

    @mikkelal
    Contributor

    The same is also happening with progress when using Deno.

    import { progress } from '@clack/prompts'
    
    const spin = progress()
    spin.start('Hello')
    spin.stop('World')
    
    // process.stdin.unref?.(); // this is needed to exit with Deno

    Deno Version: v2.6.10
    Package Version: 1.0.1

    Seems like this related to this Deno issue: denoland/deno#30075 (comment)

  7. 43081j commented on Feb 24, 2026

    @43081j
    Collaborator

    yup this sounds like a deno bug.

    the original bug in this thread also has no repro in 1.x, so im going to close this.

    we do clear all timers and such on exit fyi.

  8. moved this from Needs triage to Done in Triage Boardon Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions