about summary refs log tree commit homepage
path: root/lib/unicorn.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-03-02 19:27:44 -0800
committerEric Wong <normalperson@yhbt.net>2009-03-03 11:14:59 -0800
commit40fadd79cee6a26fc124ad42297754b88d5c59e5 (patch)
tree3295854c96266b7a24cb5d64a59ce52071121e13 /lib/unicorn.rb
parent56aaf96ffccebf70bf98f41c64bf533cef68f802 (diff)
downloadunicorn-40fadd79cee6a26fc124ad42297754b88d5c59e5.tar.gz
As opposed to doing this in the shell, this allows the files to
be reopened reliably after rotation.

While we're at it, use $stderr/$stdout instead of STDERR/STDOUT
since they seem to be more favored.
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r--lib/unicorn.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 998f8b8..d5867b1 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -90,6 +90,9 @@ module Unicorn
       listen(Const::DEFAULT_LISTENER) if @listeners.empty?
       self.pid = @config[:pid]
       build_app! if @preload_app
+      $stderr.reopen(@stderr_path, "a") if @stderr_path
+      $stdout.reopen(@stdout_path, "a") if @stdout_path
+      $stderr.sync = $stdout.sync = true
       spawn_missing_workers
       self
     end