Sha256: bf6f22238389d9f49b913f0aae7ef4d0449edc850b2488e64101e5c226c629e1

Contents?: true

Size: 1.11 KB

Versions: 21

Compression:

Stored size: 1.11 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 = "bundle exec rackup -s #{defined?(JRUBY_VERSION) ? 'puma' : 'thin'}"
    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

21 entries across 21 versions & 1 rubygems

Version Path
rhoconnect-7.6.0 commands/rhoconnect/startbg.rb
rhoconnect-7.5.1 commands/rhoconnect/startbg.rb
rhoconnect-7.4.1 commands/rhoconnect/startbg.rb
rhoconnect-7.1.17 commands/rhoconnect/startbg.rb
rhoconnect-6.2.0 commands/rhoconnect/startbg.rb
rhoconnect-6.0.11 commands/rhoconnect/startbg.rb
rhoconnect-5.5.18 commands/rhoconnect/startbg.rb
rhoconnect-5.5.17 commands/rhoconnect/startbg.rb
rhoconnect-5.5.15 commands/rhoconnect/startbg.rb
rhoconnect-5.5.0.22 commands/rhoconnect/startbg.rb
rhoconnect-5.5.2 commands/rhoconnect/startbg.rb
rhoconnect-5.5.0.7 commands/rhoconnect/startbg.rb
rhoconnect-5.5.0.3 commands/rhoconnect/startbg.rb
rhoconnect-5.5.0 commands/rhoconnect/startbg.rb
rhoconnect-5.1.1 commands/rhoconnect/startbg.rb
rhoconnect-4.0.4 commands/rhoconnect/startbg.rb
rhoconnect-4.0.3 commands/rhoconnect/startbg.rb
rhoconnect-4.0.2 commands/rhoconnect/startbg.rb
rhoconnect-4.0.1 commands/rhoconnect/startbg.rb
rhoconnect-4.0.0 commands/rhoconnect/startbg.rb