StandardFileStream not closing files immediately

David T. Lewis lewis at mail.msen.com
Tue Dec 28 17:20:15 UTC 2004


On Wed, Dec 29, 2004 at 12:44:16AM +0800, Yar Hwee Boon wrote:
> On Tue, 28 Dec 2004 11:29:35 -0500, David T. Lewis <lewis at mail.msen.com>  
> wrote:
> 
> > StandardFileStream>>close is the method that closes the file cleanly
> > and makes sure that the external file handle gets closed. If you
> > use this to explicitly close all file streams that refer to the
> > file, you should then be able to delete the file.
> 
> Thanks. I was clear enough. What I mean was after I close the file stream  
> by sending #close, the file is not close immediately. For eg. if I check  
> by sending #closed to the stream immediately after sending #close, it  
> _sometimes_ answer false. But if I do a gc, or put a self halt than click  
> proceed immediately when I see the debugger window, it will be ok. I can't  
> rule out the possibility that its a bug in my code, but it certainly seems  
> that #close does not work as you described. BTW, this is on windows.

Oh, I see. Perhaps this is Windows specific behavior. I don't have a
Windows box at hand, but on Linux if I do this:

  (1 to: 1000) collect: [:e | (FileStream fileNamed: 'junk.txt') close closed]

I get an array of all true. Do you get some false results in the array
when you do it on your system?

Dave




More information about the Squeak-dev mailing list