Limit number of compiler error messages

Stewart Gordon smjg_1998 at yahoo.com
Sun May 27 11:31:51 PDT 2012


On 22/05/2012 18:36, cal wrote:
<snip>
>> <my build command> 2>&1 | head -n <number of lines you want to see>
>>
>> Where <my build command> is your dmd/rdmd/build script command. There's probably
>> something similar you could use on Windows, I don't really know though.

By "something similar" do you mean a way of piping stderr, or a head utility?

A head utility is trivial to code.  Of course, a way to pipe stderr is another matter.

> They are probably all valid errors, I am porting a rather large C file to D and it takes a
> few seconds (perhaps 10 seconds) for the compiler to finish listing all the things I
> haven't fixed up yet, makes the process a bit more tedious is all. No biggy, thought there
> might be a switch I missed.
>
> Interestingly, I don't seem able to redirect the compiler output on Windows, or even pipe it.

What version of Windows are you using?

Modern versions support 2> to redirect stderr to a file.  But 2| doesn't seem to work 
correspondingly (at least under Vista, don't know about Win7) - by the looks of it it just 
passes 2 as an argument to the program and pipes stdout as usual.

Maybe a utility could be made along similar lines to Rederr (which I published somewhere 
on these 'groups OUAT)....

Stewart.


More information about the Digitalmars-d-learn mailing list