Sha256: e366075a638022fd656aa3cf29ed6fb645f60c83f454111af0483f1c4a534a53

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# NOTE: On Windows Process.fork is implemented in a way
# that it re-starts the parent command with an additional "child#0"
# argument. Naturally, this leads to Thor rejecting that 2nd invocation
# since the original command is not supposed to have arguments.
# To overcome this issue all Background commands
# should have an optional fictitious parameter (which is not used)
# but exists merely to support Windows Process.fork artificial implementation
Execute.define_task do
  desc "startbg [CHILDNAME]", "Start rhoconnect server in bg mode (Rhostudio) - this is an internal command", :hide => true
  def startbg(childname=nil)
    cmd = (jruby?) ? trinidad? : (thin? || mongrel? || report_missing_server)
    require 'win32/process' if windows?
    
    p1 = Process.fork {  
      if windows?
        puts 'Starting rhoconnect ...'
        system "#{cmd} config.ru -P #{rhoconnect_pid}"
      elsif jruby?
        puts 'Starting rhoconnect in jruby environment...'
        system "#{cmd} -r config.ru"
      else
        system "#{cmd} config.ru -P #{rhoconnect_pid}"
      end
    }
    Process.detach(p1)
    
    exit
  end #startbg
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rhoconnect-4.0.0.beta.10 commands/rhoconnect/startbg.rb
rhoconnect-4.0.0.beta.12 commands/rhoconnect/startbg.rb