You can clone with
HTTPS or Subversion.
rake sunspot:solr:start gives fork is not available on this platform when using JRuby. Is there another method other than fork that would be used to start Solr in the background.
fork is not available on this platform
My problem is I can't automatically start Solr before my tests run I have manually start Solr in the foreground using rake sunspot:solr:run.
The answer might be to use spawn provided by the spoon gem: http://rubydoc.info/gems/spoon/0.0.1/frames
I'll have a go myself. Of course this would add an extra dependency but only for JRuby.
How's this going? I like the idea of being able to run on JRuby.
rake sunspot:solr:run on Windows with JRuby
I don't know if this is a Windows issue or a JRuby issue, but the exec at line 104 in sunspot/solr/server.rb is causing a problem.
The java command line reports an error that it can not find the start.jar. I added some debug to my copy and discovered that the exec'ed java command is not actually being executed in the correct directory. If I change the exec(...) to a system(...) it works fine. I think system would be a safer style of command execution on all platforms. This rake task is only used during development and test so optimisation is not so necessary.
IMO, we should drop responsibility for backgrounding. Leave that up to foreman or the like.
Cool with me. Just drop sunspot:solr:run and print out a useful message about it?
Speaking as someone who is using Sunspot, I'd rather not have install foreman. I like using the sunspot:solr:run task to fire up solr. My patched version using "system" works fine and should be consistent across ruby platforms. My sugestion is just that you just change exec(...) to system(...).
I might have conflated two issues with my response — sunspot:solr:run should always work to run Solr in the foreground. I'm on the fence about sunspot:solr:start taking on the responsibility of backgrounding. Sunspot is not a process manager ;)
Also, running a multi-core Solr on a single port (another WIP for 2.0) could help alleviate the inconvenience mentioned earlier by @krisleech.
I meant to say sunspot:solr:start above, doh!
sunspot:solr:start works perfectly on my mac (my main development environment). Is there any reason why you'd want to remove something that works fine? Is it causing you a maintenance headache?
@freakent sunspot:solr:start it breaks on Windows and JRuby IIRC. So perhaps the better option is to keep our implementation naive (print a notice on exception?) unless a suitably trivial fix can be contributed for those platforms.
As far as I understood, on Jruby/Windows s:s:start gives a message saying it is not supported on that platform and you should use s:s:run. That's fair enough as long as s:s:run works, and my suggestion is to swap the exec() for a system(). Seems like a minor fix to me.
I was having the same issue as freakent with JRuby on Windows. His solution of replacing the call to exec(...) on line 104 of server.rb with a call to system(...) worked for me as well.
AFAIK it is fork  in start which is not supported by JRuby on any platform. The exec (or system) calls in run are fine, at least on Unix.
The need to swap exec for system on Windows should be opened as a separate issue IMHO.
I'm going to close this one, since it's rather old. I am still of the opinion that we should support :run everywhere, but consider the backgrounding behavior of :start to be optional given platform differences. Managing background processes should not be within Sunspot's scope of concerns, unless someone can show me a fairly minimal pull request that adds support on all platforms.