unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Benedikt Böhm" <bb@xnull.de>
To: mongrel-unicorn@rubyforge.org
Cc: "Benedikt Böhm" <bb@xnull.de>
Subject: [PATCH] make stderr_path/stdout_path support IO objects directly
Date: Thu, 22 Mar 2012 08:14:09 +0100	[thread overview]
Message-ID: <1332400449-25478-1-git-send-email-bb@xnull.de> (raw)

---
 lib/unicorn/configurator.rb |    2 +-
 lib/unicorn/http_server.rb  |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 89cbf5c..c9b6816 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -559,7 +559,7 @@ private
 
   def set_path(var, path) #:nodoc:
     case path
-    when NilClass, String
+    when NilClass, String, IO
       set[var] = path
     else
       raise ArgumentError
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 0c2af5d..bd71fbf 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -698,7 +698,11 @@ class Unicorn::HttpServer
   end
 
   def redirect_io(io, path)
-    File.open(path, 'ab') { |fp| io.reopen(fp) } if path
+    if path.is_a?(IO)
+      io.reopen(path)
+    elsif path
+      io.reopen(path, 'ab')
+    end
     io.sync = true
   end
 
-- 
1.7.4.5

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

             reply	other threads:[~2012-03-22  7:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-22  7:14 Benedikt Böhm [this message]
2012-03-22  8:00 ` [PATCH] make stderr_path/stdout_path support IO objects directly Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332400449-25478-1-git-send-email-bb@xnull.de \
    --to=bb@xnull.de \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).