cygwin GNU make .net program piping inconsistent behavior

Posted by Codism on Programmers See other posts from Programmers or by Codism
Published on 2012-03-27T14:36:50Z Indexed on 2012/03/27 17:42 UTC
Read the original article Hit count: 362

Filed under:
|
|
|

This question may sound like a superuser question but I feel there is something related to programming. Anyway, my computer had a fresh installation of Win 7 64 and cygwin recently. Now I observed some problem with pipe handling in gnu make file. The following is the Makefile I use to reproduce the issue:

all:
    fsutil | cat
    my-dotnet-console.exe | cat

The problem is: for the first command line, the piping works every time but for the second command line, the piping barely works - I got no result for the second command for most cases, regardless of the environment (cmd or bash) in which the make file is invoked. However, if I copy paste the second command line into cmd (or bash), the pipe works every time. The following is my .net program:

static void Main(string[] args)
{
    Console.WriteLine(new string('a', 40));
    Console.Out.Flush();
}

The make version is 3.82.90 but the same problem was observed in a previous version (because of the windows path handling problem in 3.82.9, I replaced make.exe with a previous version). I don't know the exact cygwin version I have installed but the current version on cygwin.com is 1.7.11-1.

Currently, my work around is to redirect the output to a temporary file but it would be great if I can avoid the temporary file.

Thanks

© Programmers or respective owner

Related posts about .NET

Related posts about cygwin