Summary: Compiler must verify exe path is writable before
                    attempting compilation
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Andrej Mitrovic <> 2012-09-28 
18:30:07 PDT ---
Windows example:

module test;

import std.stdio;
import std.process;

void main()
    system("echo > test.exe");
    auto file = File("test.exe", "r");
    system("dmd test2.d -oftest.exe");

module test2;

import std.string;
string mixMe()
    string res;
    foreach (i; 0 .. 3_000)
        res ~= xformat("int i_%s;", i);
    return res;


void main()

$ rdmd test1.d
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
OPTLINK : Error 3: Cannot Create File test.exe
--- errorlevel 1

test2.d demonstrates a module that takes a longer while to compile. test1.d
creates a phony test.exe, then opens it in read-mode to lock it. Then it
attempts to compile test2.d and write over test.exe.

DMD will first compile test2.d and only then attempt to write to test.exe and
fail. This can be a considerate waste of time, the compiler should check if the
output location is writable *before* attempting to compile.

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

Reply via email to