From d960563139192baf39a380055fce85ed5ecde465 Mon Sep 17 00:00:00 2001 From: Niels Ganser Date: Sat, 18 Jul 2009 21:14:21 +0200 Subject: [PATCH] Workaround for Tempfile#unlink change in 1.9.1-p152 Starting with patchlevel 152, Ruby 1.9 closes a Tempfile upon unlinking it. In such cases we would run into IOErrors (closed stream) when trying to keep using @rewindable_io after unlinking it. --- lib/rack/rewindable_input.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/rack/rewindable_input.rb b/lib/rack/rewindable_input.rb index accd96b..b4d1952 100644 --- a/lib/rack/rewindable_input.rb +++ b/lib/rack/rewindable_input.rb @@ -74,7 +74,7 @@ module Rack @rewindable_io.chmod(0000) @rewindable_io.set_encoding(Encoding::BINARY) if @rewindable_io.respond_to?(:set_encoding) @rewindable_io.binmode - if filesystem_has_posix_semantics? + if filesystem_has_posix_semantics? && "#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}" < "1.9.1.152" @rewindable_io.unlink @unlinked = true end -- 1.6.0.4