* [PATCH] make stderr_path/stdout_path support IO objects directly
@ 2012-03-22 7:14 Benedikt Böhm
2012-03-22 8:00 ` Eric Wong
0 siblings, 1 reply; 2+ messages in thread
From: Benedikt Böhm @ 2012-03-22 7:14 UTC (permalink / raw)
To: mongrel-unicorn; +Cc: Benedikt Böhm
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] make stderr_path/stdout_path support IO objects directly
2012-03-22 7:14 [PATCH] make stderr_path/stdout_path support IO objects directly Benedikt Böhm
@ 2012-03-22 8:00 ` Eric Wong
0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2012-03-22 8:00 UTC (permalink / raw)
To: unicorn list; +Cc: Benedikt Böhm
Benedikt Böhm <bb@xnull.de> wrote:
Hello, can you explain in the commit message why this functionality is
useful to have?
SIGUSR1 log file reopening only works because it relies on knowing
File#path on File objects
> ---
> lib/unicorn/configurator.rb | 2 +-
> lib/unicorn/http_server.rb | 6 +++++-
> 2 files changed, 6 insertions(+), 2 deletions(-)
Test cases for new functionality would be nice, too.
_______________________________________________
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-22 8:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-22 7:14 [PATCH] make stderr_path/stdout_path support IO objects directly Benedikt Böhm
2012-03-22 8:00 ` Eric Wong
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).