From 4414d9bf34f162a604d2aacc765ab1ca2fc90404 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 27 Feb 2009 17:04:13 -0800 Subject: Remove -P/--pid switch from CLI It's confusing with the lowercase "-p" option which is more common for developers to use. PID files are only needed for production deployments, and those should be using config files anyways. --- bin/unicorn | 4 ---- test/exec/test_exec.rb | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bin/unicorn b/bin/unicorn index c306c98..30a4dfa 100755 --- a/bin/unicorn +++ b/bin/unicorn @@ -66,10 +66,6 @@ opts = OptionParser.new("", 24, ' ') do |opts| daemonize = d ? true : false end - opts.on("-P", "--pid FILE", "file to store PID (default: none)") do |f| - options[:pid] = File.expand_path(f) - end - # Unicorn-specific stuff opts.on("-l", "--listen {HOST:PORT|PATH}", "listen on HOST:PORT or PATH", diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb index 4d314a4..5806210 100644 --- a/test/exec/test_exec.rb +++ b/test/exec/test_exec.rb @@ -376,24 +376,30 @@ end # after_fork def test_reexec File.open("config.ru", "wb") { |fp| fp.syswrite(HI) } pid_file = "#{@tmpdir}/test.pid" + ucfg = Tempfile.new('unicorn_test_config') + ucfg.syswrite("pid \"#{pid_file}\"\n") pid = fork do redirect_test_io do - exec($unicorn_bin, "-l#{@addr}:#{@port}", "-P#{pid_file}") + exec($unicorn_bin, "-l#{@addr}:#{@port}", "-c#{ucfg.path}") end end - reexec_basic_test(pid, pid_file) + wait_for_file(pid_file) + reexec_usr2_quit_test(pid, pid_file) end def test_reexec_alt_config config_file = "#{@tmpdir}/foo.ru" - File.open(config_file, "wb") { |fp| fp.syswrite(HI) } pid_file = "#{@tmpdir}/test.pid" - pid = fork do + ucfg = Tempfile.new('unicorn_test_config') + ucfg.syswrite("pid \"#{pid_file}\"\n") + File.open(config_file, "wb") { |fp| fp.syswrite(HI) } + pid = xfork do redirect_test_io do - exec($unicorn_bin, "-l#{@addr}:#{@port}", "-P#{pid_file}", config_file) + exec($unicorn_bin, "-l#{@addr}:#{@port}", "-c#{ucfg.path}", config_file) end end - reexec_basic_test(pid, pid_file) + wait_for_file(pid_file) + reexec_usr2_quit_test(pid, pid_file) end def test_unicorn_config_file @@ -413,8 +419,7 @@ end # after_fork File.open("config.ru", "wb") { |fp| fp.syswrite(HI) } pid = xfork do redirect_test_io do - exec($unicorn_bin, "-l#{@addr}:#{@port}", - "-P#{pid_file}", "-c#{ucfg.path}") + exec($unicorn_bin, "-l#{@addr}:#{@port}", "-c#{ucfg.path}") end end results = retry_hit(["http://#{@addr}:#{@port}/"]) -- cgit v1.2.3-24-ge0c7