Open benjamincburns opened 2 years ago
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);
The spinner is removed as expected, but the node process hangs after printing the text I should exit now.
node
I should exit now
The following code exits as expected (note the addition of spinners.checkIfActiveSpinners() after the call to spinners.remove:
spinners.checkIfActiveSpinners()
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);
I think the fix proposed in SweetMNM/dreidels#1 (a PR to a fork of this project) would also work here, though the patch itself likely wouldn't apply cleanly.
Odd that merging my PR to my forked repo closed this ticket... ¯_(ツ)_/¯
note that if call spinners.succeed("spinner-1"); before or instead of remove it works.
Expected Behavior
The code below should exit cleanly after the timeout callback is fired.
Actual Behavior
The spinner is removed as expected, but the
node
process hangs after printing the textI should exit now
.Workaround
The following code exits as expected (note the addition of
spinners.checkIfActiveSpinners()
after the call tospinners.remove
:Potential fix
I think the fix proposed in SweetMNM/dreidels#1 (a PR to a fork of this project) would also work here, though the patch itself likely wouldn't apply cleanly.