# File lib/lumberjack/device/rolling_log_file.rb, line 105 def do_once(file) begin file.flock(File::LOCK_EX) rescue SystemCallError # Most likely can't lock file because the stream is closed return end begin verify = file.lstat rescue nil # Execute only if the file we locked is still the same one that needed to be rolled yield if verify && verify.ino == @file_inode && verify.size > 0 ensure file.flock(File::LOCK_UN) rescue nil end end