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

Bug: Process doesn't exit when remove is called on an active spinner #34

Open
benjamincburns opened this issue Mar 30, 2022 · 2 comments · Fixed by trufflesuite/spinnies#1

Comments

@benjamincburns
Copy link

benjamincburns commented Mar 30, 2022

Expected Behavior

The code below should exit cleanly after the timeout callback is fired.

const Spinnies = require("spinnies");

const spinners = new Spinnies();

spinners.add("spinner-1", { text: "some spinner" });

setTimeout(() => {
  spinners.remove("spinner-1");
  console.log("I should exit now!");
},1000);

Actual Behavior

The spinner is removed as expected, but the node process hangs after printing the text I should exit now.

Workaround

The following code exits as expected (note the addition of spinners.checkIfActiveSpinners() after the call to spinners.remove:

const Spinnies = require("spinnies");

const spinners = new Spinnies();

spinners.add("spinner-1", { text: "some spinner" });

setTimeout(() => {
  spinners.remove("spinner-1");
  spinners.checkIfActiveSpinners();
  console.log("I should exit now!");
},1000);

Potential fix

I think the fix proposed in SweetMNM#1 (a PR to a fork of this project) would also work here, though the patch itself likely wouldn't apply cleanly.

@benjamincburns
Copy link
Author

Odd that merging my PR to my forked repo closed this ticket... ¯_(ツ)_/¯

@rafipiccolo
Copy link

note that if call spinners.succeed("spinner-1"); before or instead of remove it works.

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

Successfully merging a pull request may close this issue.

2 participants