diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-03-09 15:16:28 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-03-09 15:16:28 -0700 |
commit | 5b308775a8c46d71b126f623cef196540a44985a (patch) | |
tree | b34feee89ec53cb041b0a1e12449740aa392c7a0 | |
parent | 1886fc49b2a4319f2d356c916f17d113cced582d (diff) | |
download | unicorn-5b308775a8c46d71b126f623cef196540a44985a.tar.gz |
This reverts commit e66ab79b8b5bc5311c750bf03868a7b2574f4ea1. Conflicts: bin/unicorn
-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 |