diff options
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r-- | lib/unicorn.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb index 5b12fc8..aad4c3d 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -125,6 +125,13 @@ module Unicorn @pid = path end + # sets the path for running the master and worker process, useful for + # running and reexecuting from a symlinked path like Capistrano allows + def directory=(path) + Dir.chdir(path) if path + @directory = path + end + # add a given address to the +listeners+ set, idempotently # Allows workers to add a private, per-process listener via the # @after_fork hook. Very useful for debugging and testing. @@ -316,7 +323,7 @@ module Unicorn ENV.replace(@start_ctx[:environ]) ENV['UNICORN_FD'] = @listeners.map { |sock| sock.fileno }.join(',') File.umask(@start_ctx[:umask]) - Dir.chdir(@start_ctx[:cwd]) + Dir.chdir(@cwd || @start_ctx[:cwd]) cmd = [ @start_ctx[:zero] ] + @start_ctx[:argv] logger.info "executing #{cmd.inspect} (in #{Dir.pwd})" exec(*cmd) |