I ran into this when trying to fix the Phobos unit tests and have reduced it down to this test file:

import std.stdio, std.file;

void main() {
    auto f = File("test.txt", "w");
    //f.close();
    std.file.remove("test.txt");
}

This compiles and runs fine on linux and the autotester shows that it works on all the tested Posix platforms, but it fails on Windows with

std.file.FileException@std\file.d(433): test.txt: The process cannot access the file because it is being used by another process.

Uncommenting the f.close() gets it to work fine on all supported platforms, no doubt it has to do with the different OS APIs that are being called.

This seems like inconsistent behavior: should I file a bug?

Reply via email to