On Saturday, 31 July 2021 at 12:03:49 UTC, DLearner wrote:
Hi

This may be due to Windows, not DMD.

Please see code below (held in test.d):

```
void main() {
   import std.stdio;

   writeln("Test");
   assert(false, "TestAssert");
}
```
`
dmd -i -run test.d
`
results in both "Test" and the "TestAssert" string (and trace) being routed to screen.

But
`
dmd -i -run test.d > op.txt
`
results in only "Test" going into op.txt, the "TestAssert" string (and trace) being routed to screen as before.

I expected both "Test" and the "TestAssert" string (and trace) to go into op.txt.

"Test" is written to the standard out stream; "TestAssert" is written to the standard error stream. > only redirects standard out, so the error stream continues to write to the terminal.

Stream redirection depends on your shell. PowerShell docs appear to be here:
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-7.1

Reply via email to