diff options
-rwxr-xr-x | bin/unicorn | 3 | ||||
-rw-r--r-- | test/exec/test_exec.rb | 10 |
2 files changed, 8 insertions, 5 deletions
diff --git a/bin/unicorn b/bin/unicorn index dd4cc64..0956d6f 100755 --- a/bin/unicorn +++ b/bin/unicorn @@ -114,9 +114,8 @@ abort "configuration file #{config} not found" unless File.exist?(config) if config =~ /\.ru$/ cfgfile = File.read(config) - # parse embedded command-line options in config.ru comments if cfgfile[/^#\\(.*)/] - opts.parse! $1.split(/\s+/) + warn %(not parsing embedded command-line options: "#$1") end inner_app = eval "Rack::Builder.new {(#{cfgfile}\n)}.to_app", nil, config else diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb index 9f65ce3..5ba5d9c 100644 --- a/test/exec/test_exec.rb +++ b/test/exec/test_exec.rb @@ -310,14 +310,18 @@ end # after_fork assert status.success?, "exited successfully" end - def test_read_embedded_cli_switches + def test_ignore_embedded_cli_switches + port2 = unused_port(@addr) File.open("config.ru", "wb") do |fp| - fp.syswrite("#\\ -p #{@port} -o #{@addr}\n") + fp.syswrite("#\\ -p #{port2} -o #{@addr}\n") fp.syswrite(HI) end - pid = fork { redirect_test_io { exec($unicorn_bin) } } + pid = fork do + redirect_test_io { exec($unicorn_bin, "-l#{@addr}:#{@port}") } + end results = retry_hit(["http://#{@addr}:#{@port}/"]) assert_equal String, results[0].class + assert_raises(Errno::ECONNREFUSED) { TCPSocket.new(@addr, port2) } assert_shutdown(pid) end |