From: Gregory Brown Date: 2009-04-30T23:53:52+09:00 Subject: Re: Read and re-write file with one open? On Thu, Apr 30, 2009 at 10:41 AM, James Dinkel wrote: > What about if another program opens the file after it has been read by > the Ruby program but before the Ruby program has copied the temp file? > If the second program makes a change and saves it, those changes will be > lost when the Ruby program copies the temp file over it.  Or if the > second program still has it open and the Ruby program finishes, then > when the second program saves it's open file, it will overwrite the Ruby > program's changes. Is this related to the OP's concerns? In this case, you'd need file locking (see the Ruby API). But I didn't see any mention of these sorts of issues in Adam's original post. If you need this feature, read the API docs for File#flock -greg