Basic question about stderr

chaseratx via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 21 15:10:10 PDT 2016


On Saturday, 21 May 2016 at 21:54:43 UTC, Era Scarecrow wrote:
> On Saturday, 21 May 2016 at 21:47:20 UTC, chaseratx wrote:
>> Thanks Era, but I am not trying to fix the range error.  That 
>> was put there intentionally to create stderr output.  I'm 
>> trying to figure out how to get ALL stderr output directed to 
>> a file the same as if I had used a "2>error.log" redirect from 
>> the command line.
>
>  Ahh, I didn't realize you were intentionally trying to use the 
> exception for the error output.
>
>  I wonder, this sounds like a TLS (Thread Local Storage) issue 
> where the local thread's stderr was updated but the global 
> (shared?) one wasn't.
>
> https://dlang.org/phobos/std_stdio.html#.stderr
>
> The stderr is defined as "File stderr", not shared. I'm 
> convinced TLS is the likely culprit. Unless you can affect the 
> original instantiation it probably isn't going to work. I just 
> tried using a static this() and it has a similar effect but 
> doesn't affect stderr. :(

Ok, thanks for looking into it.  It does seem like it should work 
(to me) since there is no apparent difference between stdout and 
stderr in the docs, and using open() works for stdout.  Not 
something I could intuit.

Appreciate the help.


More information about the Digitalmars-d-learn mailing list