"Ernest W. Durbin III" <[email protected]> wrote:
> On Fri, Nov 1, 2013 at 1:46 PM, Hleb Valoshka <[email protected]> wrote:
> > On 11/1/13, Ernest W. Durbin III <[email protected]> wrote:
> >
> >> +      LISTENERS.map do |sock|
> >
> > You mean LISTENERS.each, aren't you? :)

Yes, LISTENERS.each is correct here.  Thanks for the catch!

> the call has been to `LISTENERS.map` as far back in the history of
> lib/unicorn/http_server.rb as i could find.

It used to be map because we wanted it to return an array.  Now we don't
care for the return value, so I've tweaked it to each.

Pushed out the following, thanks all.  Should have out 4.7.0 within
a few days (few more cleanups while we're at it).

>From 7e9e4c740aba24096f768f578779dc1053cb8b70 Mon Sep 17 00:00:00 2001
From: "Ernest W. Durbin III" <[email protected]>
Date: Fri, 1 Nov 2013 10:12:33 -0400
Subject: [PATCH] construct listener_fds Hash in 1.8.6 compatible way

This renables the ability for Ruby 1.8.6 environments to perform reexecs

[ew: clarified this is for 1.8.6,
 favor literal {} over Hash.new,
 tweaked LISTENERS.map => LISTENERS.each, thanks to Hleb Valoshka
]

Signed-off-by: Eric Wong <[email protected]>
---
 lib/unicorn/http_server.rb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 2decd77..402f133 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -449,13 +449,14 @@ class Unicorn::HttpServer
     end
 
     self.reexec_pid = fork do
-      listener_fds = Hash[LISTENERS.map do |sock|
+      listener_fds = {}
+      LISTENERS.each do |sock|
         # IO#close_on_exec= will be available on any future version of
         # Ruby that sets FD_CLOEXEC by default on new file descriptors
         # ref: http://redmine.ruby-lang.org/issues/5041
         sock.close_on_exec = false if sock.respond_to?(:close_on_exec=)
-        [ sock.fileno, sock ]
-      end]
+        listener_fds[sock.fileno] = sock
+      end
       ENV['UNICORN_FD'] = listener_fds.keys.join(',')
       Dir.chdir(START_CTX[:cwd])
       cmd = [ START_CTX[0] ].concat(START_CTX[:argv])
-- 
1.8.4.483.g7fe67e6.dirty

_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Reply via email to