From 13dc5b88cde691cc4e105de04ebb7804ae633ae6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 15 Jun 2010 23:17:33 +0000 Subject: workaround rbx not reopening logs to stderr/stdout While log reopening worked reliably for newly-created File objects in the unit tests, the $stderr and $stdout handles that get redirected did not get reopened reliably under Rubinius. We work around this by relying on Rubinius internals and directly setting the @path instance variable. This is harmless for MRI and should be harmless for other any other Ruby implementations we'll eventually support. ref: http://github.com/evanphx/rubinius/issues/360 --- lib/unicorn.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/unicorn.rb') diff --git a/lib/unicorn.rb b/lib/unicorn.rb index a7b0646..9dcdc29 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -816,7 +816,12 @@ module Unicorn end def redirect_io(io, path) - File.open(path, 'ab') { |fp| io.reopen(fp) } if path + File.open(path, 'ab') do |fp| + io.reopen(fp) + + # workaround for http://github.com/evanphx/rubinius/issues/360 + io.instance_variable_set(:@path, path) if io.path.nil? + end if path io.sync = true end -- cgit v1.2.3-24-ge0c7