class SystemUniversal

def tmpdir d = Dir.tmpdir, max = 42, &b

def tmpdir d = Dir.tmpdir, max = 42, &b
  i = -1 and loop{
    i += 1
    tmp = File.join(d, slug_for("systemu_#{ @host }_#{ @ppid }_#{ @pid }_#{ rand }_#{ i += 1 }"))
    begin
      Dir.mkdir tmp
    rescue Errno::EEXIST
      raise if i >= max
      next
    end
    break(
      if b
        begin
          b.call tmp
        ensure
          FileUtils.rm_rf tmp unless SystemU.turd
        end
      else
        tmp
      end
    )
  }
end