Summary: File.byLine doesn't release file handle
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos

--- Comment #0 from Andrej Mitrovic <> 2011-11-27 
15:21:59 PST ---
import std.stdio;
import std.file;
import std.process;

void test()
    auto file = File("test.txt", "r");
    foreach (line; file.byLine)  // remove and bug goes away

void main()
    system("echo blabla > test.txt");  // create file externally

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

Btw this has nothing to do with that system call, you can remove it if you have
a test.txt file.

As a workaround I can use scope(exit){ file.close(); }

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to