[erlang-questions] Reading a file before it has been completely written
Thu Mar 8 15:23:30 CET 2012
On Wednesday, March 07, 2012, I wrote:
> On Wednesday, March 07, 2012, Richard Carlsson wrote:
> > Trying to fiddle with exclusive locks is probably always
> > to have corner cases. The only techniques you can trust to
> > always work and be portable across file systems are directory
> > and file renaming. So what Tony suggested is likely to be the best
> > solution: create the file under another name or in a separate
> > directory,
> > and when it's completely written, rename it.
> I might go back to my renaming approach, which also had no failures
> testing. I just attempt to rename the file to itself. If it fails, I
> again 5 seconds later.
For closure here, I went back to my approach of attempting to rename the
file to itself before reading it. I'll let y'all know if I encounter any
more corner cases.
More information about the erlang-questions