Differences between revisions 1 and 2
Revision 1 as of 2010-11-28 22:59:48
Size: 633
Editor: abuehl
Comment: under construction
Revision 2 as of 2010-11-28 23:20:03
Size: 1011
Editor: abuehl
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
Normally, Python's '`os.unlink(f)`' deletes the file f. This page describes what happens when Python's '`os.unlink(f)`' is called on Windows.
Line 9: Line 9:
On Windows, if f has been opened for reading by another process with '`posixfile(f)`', calling == File opened using Python's "open" ==

If the file f has been opened for reading by another other process using Python's '`open(f)`',
then '`os.unlink(f)`' will raise

{{{
WindowsError: [Error 32] The process cannot access the file because it is being
used by another process: <f>
}}}

== File opened using Mercurial's "posixfile" ==

If the file f has been opened for reading by another process with '`posixfile(f)`', calling
Line 19: Line 31:

Unlinking Files on Windows

/!\ This page is intended for developers.

This page describes what happens when Python's 'os.unlink(f)' is called on Windows.

1. File opened using Python's "open"

If the file f has been opened for reading by another other process using Python's 'open(f)', then 'os.unlink(f)' will raise

WindowsError: [Error 32] The process cannot access the file because it is being
used by another process: <f>

2. File opened using Mercurial's "posixfile"

If the file f has been opened for reading by another process with 'posixfile(f)', calling unlink will send that file into a "scheduled delete" state.

Scheduled delete has the following characteristics:

  • (a) the entry in the directory for f is still kept

    (b) calling 'fd = posixfile(f, 'w')' will raise 'IOError: [Errno 13] <f>: Access is denied'

Scheduled delete is left as soon as the other process closes the file.


CategoryInternals

UnlinkingFilesOnWindows (last edited 2017-09-02 08:00:32 by abuehl)