From: barjunk Date: 2007-07-17T04:25:00+09:00 Subject: Re: Check Flock Status on File On Jul 16, 6:38 am, "ara.t.howard" wrote: > On Jul 15, 2007, at 1:30 PM, Matt wrote: > > > I have a daemon that is checking files as they are uploaded by FTP and > > processing them accordingly. > > I noticed that occasionally the files are truncated, and have put this > > down to the file currently being written by the FTP server as im > > reading it. > > I would like to check the lock status on the file, so I will only > > process the file if it is not write-locked. > > How can I check the lock status on a given filename? > > fcntl/posix (see posixlock gem) locks export that information but > flock, afaik, does not. this seems workable though > > http://drawohara.tumblr.com/post/5891548 > > -a > -- > we can deny everything, except that we have the possibility of being > better. simply reflect on that. > h.h. the 14th dalai lama So the code above modifies the File class so that an instance will include a flocked? method, right? Is it a good assumption that something like this would eventually make it into File? Mike B.