From 171df888464ec24d94a8e92e38742f86ac55d0f7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 1 Nov 2009 11:56:16 -0800 Subject: configurator: add "working_directory" directive This basically a prettier way of saying: Dir.chdir(Unicorn::HttpServer::START_CTX[:cwd] = path) In the config file. Unfortunately, this is configuration directive where order matters and you should specify it before any other path[1] directives if you're using relative paths (relative paths are not recommended anyways) [1] pid, stderr_path, stdout_path --- test/exec/test_exec.rb | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'test') diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb index 268a84e..7edfa71 100644 --- a/test/exec/test_exec.rb +++ b/test/exec/test_exec.rb @@ -75,6 +75,45 @@ end end end + def test_working_directory + other = Tempfile.new('unicorn.wd') + File.unlink(other.path) + Dir.mkdir(other.path) + File.open("config.ru", "wb") do |fp| + fp.syswrite < 'text/plain' }, [ Dir.pwd ] ] } +EOF + end + FileUtils.cp("config.ru", other.path + "/config.ru") + tmp = Tempfile.new('unicorn.config') + tmp.syswrite <