guard / listen

The Listen gem listens to file modifications and notifies you about the changes.
https://rubygems.org/gems/listen
MIT License
1.92k stars 246 forks source link

cannot start from state :stopped (ArgumentError) #580

Open AlexB52 opened 6 months ago

AlexB52 commented 6 months ago

This is more of a question than an issue

What are the reasons preventing the listener's interface to restart after a stop?

require "listen"
listener = Listen.to { |changes| puts changes }
listener.start
listener.stop
listener.start
# => cannot start from state :stopped (ArgumentError)
ColinDKelley commented 5 months ago

@AlexB52 I'm guessing there was concern about cleaning up state for reuse like that. Isn't it equally easy to create a new listener?

require "listen"
listener1 = Listen.to { |changes| puts changes }
listener1.start
listener1.stop

listener2 = Listen.to { |changes| puts changes }
listener2.start