Sha256: 69a418eecd34f54382668ba0cd46fbf6a31e0aec170a2ff814449e7ee45d8f87

Contents?: true

Size: 685 Bytes

Versions: 36

Compression:

Stored size: 685 Bytes

Contents

# -*- encoding: binary -*-
# :stopdoc:
require 'tmpdir'

# some versions of Ruby had a broken Tempfile which didn't work
# well with unlinked files.  This one is much shorter, easier
# to understand, and slightly faster.
class Unicorn::TmpIO < File

  # creates and returns a new File object.  The File is unlinked
  # immediately, switched to binary mode, and userspace output
  # buffering is disabled
  def self.new
    fp = begin
      super("#{Dir::tmpdir}/#{rand}", RDWR|CREAT|EXCL, 0600)
    rescue Errno::EEXIST
      retry
    end
    unlink(fp.path)
    fp.binmode
    fp.sync = true
    fp
  end

  # pretend we're Tempfile for Rack::TempfileReaper
  alias close! close
end

Version data entries

36 entries across 36 versions & 5 rubygems

Version Path
unicorn-5.5.1 lib/unicorn/tmpio.rb
unicorn-5.5.0.1.g6836 lib/unicorn/tmpio.rb
unicorn-5.5.0 lib/unicorn/tmpio.rb
unicorn-5.5.0.pre1 lib/unicorn/tmpio.rb
unicorn-5.4.1 lib/unicorn/tmpio.rb
unicorn-5.4.0 lib/unicorn/tmpio.rb
unicorn-5.3.1 lib/unicorn/tmpio.rb
unicorn-shopify-5.3.0 lib/unicorn/tmpio.rb
unicorn-5.3.0 lib/unicorn/tmpio.rb
unicorn-5.3.0.pre1 lib/unicorn/tmpio.rb
unicorn-shopify-5.2.0.6 lib/unicorn/tmpio.rb
unicorn-shopify-5.2.0.5 lib/unicorn/tmpio.rb
unicorn-shopify-5.2.0.4 lib/unicorn/tmpio.rb
unicorn-shopify-5.2.0.3 lib/unicorn/tmpio.rb
unicorn-shopify-5.2.0.2 lib/unicorn/tmpio.rb
unicorn-shopify-5.2.0.1 lib/unicorn/tmpio.rb
unicorn-simon-0.0.7 lib/unicorn/tmpio.rb
unicorn-simon-0.0.6 lib/unicorn/tmpio.rb
unicorn-simon-0.0.5 lib/unicorn/tmpio.rb
unicorn-simon-0.0.4 lib/unicorn/tmpio.rb