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