Stanislav Blinov Wrote:

>   Hello,
> 
> I'm receiving strange results with reading stdin on Windows 7. Consider 
> this code:
> 
> module test;
> 
> import std.stdio;
> 
> void main(string[] args)
> {
>          foreach (int i, string line; lines(stdin))
>          {
>                  write(line);
>          }
> }
> 
> On Linux, if I do 'cat test.d | ./test' I get test.d contents on stdout. 
> But on Windows 7, ('type test.d | ./test.exe') the output is this:
> 
> std.stdio.StdioException: Bad file descriptor
> module test;
> 
> import std.stdio;
> 
> void main(string[] args)
> {
>          foreach (int i, string line; lines(stdin))
>          {
>                  writef(line);
>          }
> }
> 
> So I too get type.d contents on stdout, but preceeded by StdioException 
> string. This happens with dmd 2.047 and 2.048.
> 
> Is this my error, dmd's, or Windows's piping?
> -- 

In my experience Windows hasn't gotten piping right. And it has been known to 
have bugs, this might be related: 
http://stackoverflow.com/questions/466801/python-piping-on-windows-why-does-this-not-work

Reply via email to