Method: Unicorn::Configurator#working_directory
- Defined in:
- lib/unicorn/configurator.rb
#working_directory(path) ⇒ Object
sets the working directory for Unicorn. This ensures SIGUSR2 will start a new instance of Unicorn in this directory. This may be a symlink, a common scenario for Capistrano users. Unlike all other Unicorn configuration directives, this binds immediately for error checking and cannot be undone by unsetting it in the configuration file and reloading.
532 533 534 535 536 537 538 539 540 541 542 543 544 |
# File 'lib/unicorn/configurator.rb', line 532 def working_directory(path) # just let chdir raise errors path = File.(path) if config_file && config_file[0] != ?/ && ! File.readable?("#{path}/#{config_file}") raise ArgumentError, "config_file=#{config_file} would not be accessible in" \ " working_directory=#{path}" end Dir.chdir(path) Unicorn::HttpServer::START_CTX[:cwd] = ENV["PWD"] = path end |