From: Daniel N Date: 2006-08-06T21:57:53+09:00 Subject: Re: How to tell when IO::popen is finished? ------=_Part_61264_26826564.1154869067794 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/6/06, Bob Hutchison wrote: > > > On Aug 3, 2006, at 7:19 PM, Daniel N wrote: > > > I'm on windows :) I don't need root. Ohhh gives me goosebumps ;) > > > > The problem isn't that the file isn't created. It's just that I > > don't know > > when it's finished being written. > > > > I want to incorporate this into an app but I don't want to go > > trying to grab > > the image if it doenst exist yet. > > It is possible that the OS is simply not yet finished writing the > file to disk. In unix this is forced by calling fsync (or sync on the > command line). I've got no idea what you do in windows. > > The first thing to try is to find out what the windows equivalent of > the command line 'sync' and run it before trying to open the png. If > that works then you can get fancy... > > Assuming the CL sync worked... In ruby the IO class has two methods > defined: fsync which is defined on an instance of the class, and sync > which is defined on the class. IO.sync won't do what you need, it > just forces ruby to write its buffers. You can try opening the png > file and calling fsync from there, don't know if that will work. > Alternatively, check to see of gnuplot will either give you the IO > object somehow or can be asked to fsync. If not, you might be able to > sneak into Gnuplot aliasing a method or re-opening the class or some > other trick and insert the fsync. > > Cheers, > Bob > ---- > Bob Hutchison -- blogs at hutch/> > Recursive Design Inc. -- > Raconteur -- > xampl for Ruby -- Hi Bob. Thanx very much for the information. I think I've got some homework to do ;) ------=_Part_61264_26826564.1154869067794--