about summary refs log tree commit homepage
path: root/lib/yahns/config.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/config.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/config.rb')
-rw-r--r--lib/yahns/config.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb
index e48ba4e..9a63803 100644
--- a/lib/yahns/config.rb
+++ b/lib/yahns/config.rb
@@ -99,6 +99,11 @@ class Yahns::Config # :nodoc:
     )
   end
 
+  def before_exec(&blk)
+    var = _check_in_block(nil, :before_exec)
+    @set[var] = (block_given? ? blk : args[0])
+  end
+
   def _add_hook(pfx, var, my_proc)
     case my_proc
     when Proc
@@ -397,7 +402,7 @@ class Yahns::Config # :nodoc:
       io.sync = true
     end
 
-    [ :logger, :pid, :worker_processes, :user, :shutdown_timeout,
+    [ :logger, :pid, :worker_processes, :user, :shutdown_timeout, :before_exec,
       :worker_atfork_prepare, :worker_atfork_parent, :worker_atfork_child
     ].each do |var|
       val = @set[var]