about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-02-25 15:05:14 -0800
committerEric Wong <normalperson@yhbt.net>2010-02-25 17:04:33 -0800
commit4b4ac5ed5d62cab76790661ba92a9ac4d5f1c105 (patch)
treebaef9d0ee6ab556f47db935222a603d345507c30 /bin
parent036df6c373df6d7f52005fbbd3196646934329d3 (diff)
downloadunicorn-4b4ac5ed5d62cab76790661ba92a9ac4d5f1c105.tar.gz
The temporary paths we create to mimic script/server-emulation
did not work when working_directory was used.  Now we defer
path creation until after working_directory is bound.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/unicorn_rails7
1 files changed, 3 insertions, 4 deletions
diff --git a/bin/unicorn_rails b/bin/unicorn_rails
index b327054..5204145 100755
--- a/bin/unicorn_rails
+++ b/bin/unicorn_rails
@@ -4,7 +4,6 @@ require 'unicorn/launcher'
 require 'optparse'
 require 'fileutils'
 
-rails_pid = "#{Unicorn::HttpServer::START_CTX[:cwd]}/tmp/pids/unicorn.pid"
 cmd = File.basename($0)
 daemonize = false
 listeners = []
@@ -198,12 +197,12 @@ if $DEBUG
 end
 
 # ensure Rails standard tmp paths exist
-%w(cache pids sessions sockets).each do |dir|
-  FileUtils.mkdir_p("tmp/#{dir}")
+options[:after_reload] = lambda do
+  FileUtils.mkdir_p(%w(cache pids sessions sockets).map! { |d| "tmp/#{d}" })
 end
 
 if daemonize
-  options[:pid] = rails_pid
+  options[:pid] = "tmp/pids/unicorn.pid"
   Unicorn::Launcher.daemonize!(options)
 end
 Unicorn.run(app, options)