PageRenderTime 58ms CodeModel.GetById 50ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/Ruby/lib/ruby/site_ruby/1.8/rubygems/package/f_sync_dir.rb

http://github.com/agross/netopenspace
Ruby | 23 lines | 10 code | 6 blank | 7 comment | 1 complexity | 6c0e354c95c706710fca1502e085d549 MD5 | raw file
 1# -*- coding: utf-8 -*-
 2#--
 3# Copyright (C) 2004 Mauricio Julio Fernández Pradier
 4# See LICENSE.txt for additional licensing information.
 5#++
 6
 7module Gem::Package::FSyncDir
 8
 9  private
10
11  ##
12  # make sure this hits the disc
13
14  def fsync_dir(dirname)
15    dir = open dirname, 'r'
16    dir.fsync
17  rescue # ignore IOError if it's an unpatched (old) Ruby
18  ensure
19    dir.close if dir rescue nil
20  end
21
22end
23