On 1/15/2015 4:32 AM, ref2401 wrote:
Unfortunately i'm new to using shells.

I use standard windows cmd. Here is my script:

dmd main.d -debug -unittest -wi

if %errorLevel% equ 0 (
     start main.exe
) else (
     echo --- Building failed! ---
     pause
)

I wrote "start main.exe 2> errorFile" but it doesn't work. errorFile is
empty.


Open up a command prompt and execute dmd with a nonexistent file name.

dmd foo.d 2> err.txt

You will find that dmd prints an error to err.txt, specifically that it can't find foo.d. (You can find more info about stdio handles and the command line at [1]).

Now execute it like this:

start dmd foo.d 2> err.txt

And you will find an empty err.txt. This is because you are redirecting the output of stderr from the *start* program, and not from dmd (you can read more about the start command at [2]). I'm not aware of anyway to redirect the output of a command or program executed by start.

Reply via email to