private Method

AutoRemoval.createtmp(basename, tmpdir=Dir::tmpdir) { |tmpname| ... }

There's no documentation for this item.

Source Code

# File rio/tempdir.rb, line 44
def createtmp(basename, tmpdir=Dir::tmpdir)   # :nodoc:
  if $SAFE > 0 and tmpdir.tainted?
    tmpdir = '/tmp'
  end

  lock = nil
  n = failure = 0

  begin
    Thread.critical = true
    begin
      tmpname = File.join(tmpdir, make_tmpname(basename, n))
      n += 1
    end until !@@cleanlist.include?(tmpname) and yield(tmpname)
  rescue
    p $!
    failure += 1
    retry if failure < MAX_TRY
    raise "cannot generate tempfile `%s'" % tmpname
  ensure
    Thread.critical = false
  end

  tmpname
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.