lib/zbatery.rb in zbatery-0.0.0 vs lib/zbatery.rb in zbatery-0.1.0
- old
+ new
@@ -2,11 +2,11 @@
require 'rainbows'
module Zbatery
# current version of Zbatery
- VERSION = "0.0.0"
+ VERSION = "0.1.0"
class << self
# runs the Zbatery HttpServer with +app+ and +options+ and does
# not return until the server has exited.
@@ -32,10 +32,15 @@
# config files...
FORK_HOOK = lambda { |_,_| }
class HttpServer < Rainbows::HttpServer
+ # this class is only used to avoid breaking Unicorn user switching
+ class DeadIO
+ def chown(*args); end
+ end
+
# only used if no concurrency model is specified
def worker_loop(worker)
init_worker_process(worker)
begin
ret = IO.select(LISTENERS, nil, nil, nil) and
@@ -84,10 +89,10 @@
trap(sig) { logger.info "SIG#{sig} is not handled by Zbatery" }
end
rescue => e # hopefully ignores errors on Win32...
logger.error "failed to setup signal handler: #{e.message}"
end
- worker = Worker.new(0, $stdout)
+ worker = Worker.new(0, DeadIO.new)
before_fork.call(self, worker)
worker_loop(worker) # runs forever
end
def stop(graceful = true)