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

SpinGroup hangs when used inside Prompt.ask #500

Open
cFire opened this issue Mar 6, 2024 · 1 comment
Open

SpinGroup hangs when used inside Prompt.ask #500

cFire opened this issue Mar 6, 2024 · 1 comment

Comments

@cFire
Copy link
Contributor

cFire commented Mar 6, 2024

I recently updated the cli-ui gem for a project I have and I've noticed SpinGroups have stopped working when used inside of a CLI::UI::Prompt.ask block.

I'm not entirely sure which version exactly it stopped working. I'll try to do some additional testing and narrow it down if possible.

Old cli-ui version where this still worked:
1.5.1

New cli-ui version where this no longer works:
2.2.3

Minimal example to reproduce:

require 'cli/ui'

CLI::UI::StdoutRouter.enable

def my_spinner
  CLI::UI::SpinGroup.new do |sg|
    sg.add('pending') { |spinner|
      result = { 'message' => 'mock api result' }
      sleep(0.5)
      spinner.update_title(result['message'])
    }
  end
end

# Works
my_spinner

# Hangs forever
CLI::UI::Prompt.ask('What do you want to do?') do |handler|
  handler.option('Watch a spinner spin') { my_spinner }
end
@cFire
Copy link
Contributor Author

cFire commented Mar 6, 2024

Tested some of the intermediate versions, last working version was 2.1.0 and 2.2.1 is the first version where this bug happens.

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

No branches or pull requests

1 participant