develooper Front page | perl.perl5.porters | Postings from August 2010

RE: What do we do about perl -pi on Windows?

Thread Previous | Thread Next
From:
Jan Dubois
Date:
August 9, 2010 18:12
Subject:
RE: What do we do about perl -pi on Windows?
Message ID:
048001cb3829$1a1501b0$4e3f0510$@activestate.com
On Mon, 09 Aug 2010, Jan Dubois wrote:
> On Mon, 09 Aug 2010, Ben Morrow wrote:
> > IIRC the equivalent of Unix' close-behind on Win32 is a flag that will
> > cause the OS to delete the file when it gets closed. That sounds exactly
> > right for this situation (better, in fact, than close-behind, since the
> > file needs a name to get renamed). The flag would have to be cleared
> > just before renaming, of course, which still leaves a small race
> 
> I believe there is no API that lets you revert the FILE_FLAG_DELETE_ON_CLOSE bit

Some quick browsing on MSDN also lets me believe that you cannot combine
the DELETE access mode with any other kind of access if you are on
Windows 2000/XP/2003 and are opening a remote file (i.e. by UNC name).
So in that case we would still have to manually delete the file ourselves
once we are done with it (and leaking it in case we are crashing).

Maybe everything should just stay the way it is right now. :)

Cheers,
-Jan





Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About