> > generic.py:146 - Why are we introducing a file_closer()? And, more > > importantly, why does the file closer perform an unlink instead of a > > close in this case? > > The issue is that the old code took advantage of the Unix-specific behavior > that if you open() file, and immediately unlink() it, you can still read() > from the file descriptor and get the contents of the file - the file isn't > actually removed from the filesystem until the last descriptor pointing > to it is closed. On Windows, it doesn't work like that - the unlink() > immediately fails with an Exception on a file that has been open()ed, > and you can't unlink() it until all file descriptors are close()d. > > So, the file_closer() is there to clean up the temporary file created by > generic action class, once the action has read the data from the temporary > file (in the file action).
This action actually gets called after the file has been closed, so that you don't generate an exception on Windows? If that's the case, I wonder if it would make sense to name it something like file_cleanup()? Assuming I've understood you correctly, naming it file_closer() seems to imply that this is actually involved in closing the file, which doesn't sound like it is true. What do you think? Thanks, -j _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
