Skip to content

Instantly share code, notes, and snippets.

@tarcieri
Created November 4, 2009 18:57
Show Gist options
  • Save tarcieri/226290 to your computer and use it in GitHub Desktop.
Save tarcieri/226290 to your computer and use it in GitHub Desktop.
def run_solr
defs = {
'jetty.home' => @path,
'solr.data.dir' => @path/'solr'/'data'
}.map { |k, v| "-D#{k}=#{v}" }.join(' ')
cmd = "java -jar #{@path}/start.jar #{@path/'etc'/'jetty.xml'} -classpath #{@path/'lib'} #{defs}"
# IO.popen is more portable than fork/exec (i.e. to JRuby)
pid = IO.popen(cmd, 'r').pid
puts "PID: #{pid}"
pid
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment