about summary refs log tree commit homepage
path: root/lib/yahns/server.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2013-10-30 20:24:58 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-31 05:04:33 +0000
commitbcac99b8cdcd0f32c4720d822d3049e3426f6cd3 (patch)
treea0b4e5cdf9388d4c5a6409106445f3c2678b27df /lib/yahns/server.rb
parentf9f8e25fd985b7a063da8070f3b3782b1a64a86c (diff)
downloadyahns-bcac99b8cdcd0f32c4720d822d3049e3426f6cd3.tar.gz
This allows modifying the command-line (as an array) passed to
Kernel#exec, as well as running anything necessary.
Diffstat (limited to 'lib/yahns/server.rb')
-rw-r--r--lib/yahns/server.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb
index 6439918..220381b 100644
--- a/lib/yahns/server.rb
+++ b/lib/yahns/server.rb
@@ -11,6 +11,7 @@ class Yahns::Server # :nodoc:
   attr_accessor :daemon_pipe
   attr_accessor :logger
   attr_writer :user
+  attr_writer :before_exec
   attr_writer :worker_processes
   attr_writer :shutdown_timeout
   attr_writer :worker_atfork_prepare
@@ -30,6 +31,7 @@ class Yahns::Server # :nodoc:
     @listeners = []
     @pid = nil
     @worker_processes = nil
+    @before_exec = nil
     @worker_atfork_prepare = @worker_atfork_parent = @worker_atfork_child = nil
     @user = nil
     @queues = []
@@ -246,6 +248,7 @@ class Yahns::Server # :nodoc:
       Dir.chdir(@config.value(:working_directory) || Yahns::START[:cwd])
       cmd = [ Yahns::START[0] ].concat(Yahns::START[:argv])
       @logger.info "executing #{cmd.inspect} (in #{Dir.pwd})"
+      @before_exec.call(cmd) if @before_exec
       cmd << redirects
       exec(*cmd)
     end