From: Derek Smith Date: 2009-04-09T10:28:15+09:00 Subject: Re: filelocking Joel VanderWerf wrote: > Derek Smith wrote: >> test.rb:46: undefined method `flock' for main:Object (NoMethodError) > ... >> File.open(file, 'r+') do |f| >> flock(f, File::LOCK_SH) do |f| > > That should be File.flock. OK tried that...thx!, but now I am seeing __STDERR__ test.rb:46: undefined method `flock' for File:Class (NoMethodError) from test.rb:45:in `open' from test.rb:45 from test.rb:42:in `each' from test.rb:42 __CODE__ if ( array1.length >= 1 ) array1.each { |file| File.copy(file, "#{file}.orig") if (File.size?(file) > FSIZE) File.open(file, 'r+') do |f| File.flock(f, File::LOCK_SH) do |f| f << "i got a lock" end end end } else raise StandardError, "Array 'array1' has no values, logs will not be rolled!" end -- Posted via http://www.ruby-forum.com/.