May 13, 2015
Sorry, would prefer not to create bugzilla account. Was this fixed? https://issues.dlang.org/show_bug.cgi?id=3425 (per comments it is).

I still have the issue. Also the process seems to exit with a status code of 0 even after having an exception and terminating (vs a Java program that exits with a non-zero exit code if terminating on uncaught exception).

Again this is on 64 bit Windows 8, using cygwin, dmd 2.067.1 32bit (DMD32 D Compiler v2.067.1).


$ word_count.exe < hamlet.txt | head
  1044  the
   730  and
   679  of
   648  to
   511  I
   478  a
   444  my
   401  you
   398  in
   358  Ham.
std.exception.ErrnoException@C:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(2337):  (Bad file descriptor)
----------------
0x00405820
0x00405F1F
0x00405ED3
0x00405EBD
0x00405A52
0x004059BE
0x00404D4A
0x0040494F
0x004048A6
0x004021D2
0x0040C22A
0x0040C1FF
0x0040C117
0x00407A13
0x77647C04 in BaseThreadInitThunk
0x77E1AD1F in RtlInitializeExceptionChain
0x77E1ACEA in RtlInitializeExceptionChain
Failed to flush stdout: Bad file descriptor
May 15, 2015
The bug was fixed for reading, you have a similar problem with writing: head exits and closes the pipes before your program writes all it needs.