guard / guard-spork

Guard::Spork automatically manage Spork DRb servers
https://rubygems.org/gems/guard-spork
MIT License
296 stars 58 forks source link

Running more than one spork instance #120

Closed porras closed 10 years ago

porras commented 10 years ago

Hi,

I'm trying to run two different spork instances, with different options, in different ports, in order to use them to run a different set of specs:

guard :spork, :rspec_port => 8888, :rspec_env => { ... } do
  ...
end

guard :spork, :rspec_port => 8889, :rspec_env => { ... } do
  ...
end

guard :rspec, :cli => "--drb --drb-port 8888", :spec_paths => "spec" do
  ...
end

guard :rspec, :cli => "--drb --drb-port 8889", :spec_paths => "spec_integration" do
  ...
end

This doesn't work because as far as I can tell, guard-spork kills all other spork instances (of the same type, but this two are) before starting a new one, so only the last one survives. I'd like to fix this but I think it might be like this by design so I wanted to confirm first if it's considered a bug :wink:

Otherwise, I'd be happy to be suggested another way of doing this...

xrkhill commented 10 years ago

@porras: Killing all instances of Spork is the default behavior, but can be overridden by setting the aggressive_kill option to false, e.g.:

guard :spork, :aggressive_kill => false, :rspec_port => 8888, :rspec_env => { ... } do
  # ...
end

guard :spork, :aggressive_kill => false, :rspec_port => 8889, :rspec_env => { ... } do
  # ...
end

This should ensure that all instances of Spork survive startup. Hopefully this option meets your needs. Let me know if it doesn't.

Perhaps this behavior was designed to prevent unexpected "address already in use" exceptions from surprising users who might inadvertently leave a manually-started instance of Spork running on the default port before starting Guard. You could contact Thibaud if you'd like more insight into the decision behind making this the default behavior.

porras commented 10 years ago

Thanks @xrkhill, works perfect with that option, sorry for the noise!

xrkhill commented 10 years ago

No worries @porras. I'm glad the option solved your problem.

On Wednesday, August 28, 2013, Sergio Gil Pérez de la Manga wrote:

Thanks @xrkhill https://github.com/xrkhill, works perfect with that option, sorry for the noise!

— Reply to this email directly or view it on GitHubhttps://github.com/guard/guard-spork/issues/120#issuecomment-23400581 .