1 # -*- encoding: binary -*-
2 # frozen_string_literal: false
6 # some versions of Ruby had a broken Tempfile which didn't work
7 # well with unlinked files. This one is much shorter, easier
8 # to understand, and slightly faster.
9 class Unicorn::TmpIO < File
11 # creates and returns a new File object. The File is unlinked
12 # immediately, switched to binary mode, and userspace output
13 # buffering is disabled
17 # workaround File#path being tainted:
18 # https://bugs.ruby-lang.org/issues/14485
20 path = "#{Dir::tmpdir}/#{rand}"
21 super(path, RDWR|CREAT|EXCL, 0600)
32 # pretend we're Tempfile for Rack::TempfileReaper