about summary refs log tree commit homepage
path: root/lib/unicorn/tmpio.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-04-24 02:38:15 +0000
committerEric Wong <e@80x24.org>2015-04-24 03:00:25 +0000
commit3bdf5481e49d76b4502c51e5bdd93f68bfd1f0b4 (patch)
treeed15a24ca7fc52358e30c423269de665357114cc /lib/unicorn/tmpio.rb
parent548e1e67d314f6ebd17df37ece0ee20632462f6f (diff)
downloadunicorn-3bdf5481e49d76b4502c51e5bdd93f68bfd1f0b4.tar.gz
Rack::TempfileReaper was added in rack 1.6 to cleanup temporary
files.  Make Unicorn::TmpIO ducktype-compatible so
Rack::TempfileReaper may be used to free up space used by temporary
buffer files.

Ref: <CY1PR0301MB078011EB5A22B733EB222A45A4EE0@CY1PR0301MB0780.namprd03.prod.outlook.com>
Reported-by: Mike Mulvaney <MMulvaney@bna.com>
Diffstat (limited to 'lib/unicorn/tmpio.rb')
-rw-r--r--lib/unicorn/tmpio.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/unicorn/tmpio.rb b/lib/unicorn/tmpio.rb
index 2da05a2..dcdf9da 100644
--- a/lib/unicorn/tmpio.rb
+++ b/lib/unicorn/tmpio.rb
@@ -26,4 +26,7 @@ class Unicorn::TmpIO < File
   def size
     stat.size
   end unless File.method_defined?(:size)
+
+  # pretend we're Tempfile for Rack::TempfileReaper
+  alias close! close
 end