Sha256: ad645f37a93b8ab4fa74a855011d43bad5e79d7dbc8cd4a49835c03d70187e5f
Contents?: true
Size: 1.35 KB
Versions: 6
Compression:
Stored size: 1.35 KB
Contents
$stdout.sync = $stderr.sync = true $stdin.binmode $stdout.binmode $stderr.binmode require 'navy' module Navy::Ship extend self def launch!(options) # cfg = Mule::Configurator $stdin.reopen("/dev/null") # We only start a new process group if we're not being reexecuted # and inheriting file descriptors from our parent unless ENV['NAVY_FD'] # grandparent - reads pipe, exits when master is ready # \_ parent - exits immediately ASAP # \_ unicorn master - writes to pipe when ready rd, wr = IO.pipe grandparent = $$ if fork wr.close # grandparent does not write else rd.close # unicorn master does not read Process.setsid exit if fork # parent dies now end if grandparent == $$ # this will block until HttpServer#join runs (or it dies) admiral_pid = (rd.readpartial(16) rescue nil).to_i unless admiral_pid > 1 warn "admiral failed to start, check stderr log for details" exit!(1) end exit 0 else # unicorn master process options[:ready_pipe] = wr end end # $stderr/$stderr can/will be redirected separately in the Unicorn config # cfg::DEFAULTS[:stderr_path] ||= "/dev/null" # cfg::DEFAULTS[:stdout_path] ||= "/dev/null" # cfg::SERVER[:daemonized] = true end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
navy-1.0.2 | lib/navy/ship.rb |
navy-1.0.1 | lib/navy/ship.rb |
navy-1.0.0 | lib/navy/ship.rb |
navy-0.0.3 | lib/navy/ship.rb |
navy-0.0.2 | lib/navy/ship.rb |
navy-0.0.1 | lib/navy/ship.rb |