X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB,SPF_HELO_PASS X-Spam-Check-By: sourceware.org From: "James Johnston" To: References: <004e01ccfd70$c69af3f0$53d0dbd0$@motionview3d.com> <005c01ccfd79$6341f980$29c5ec80$@motionview3d.com> <007201ccfe25$130065e0$390131a0$@motionview3d.com> <20120309195247 DOT GB18960 AT calimero DOT vinschen DOT de> <20120311013339 DOT GA32518 AT ednor DOT casa DOT cgf DOT cx> <00b701cd0059$25c26a80$71473f80$@motionview3d.com> <20120312141929 DOT GE2382 AT calimero DOT vinschen DOT de> In-Reply-To: <20120312141929.GE2382@calimero.vinschen.de> Subject: RE: Can't reliably redirect standard output from C# program in recent Cygwin Date: Mon, 12 Mar 2012 17:28:17 -0000 Message-ID: <00cf01cd0075$8430b290$8c9217b0$@motionview3d.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q2CHUaxR016325 Well, good call. I shouldn't have jumped to conclusions. Both my C++ and C# examples still fail: $ echo `./HelloCPP` ; echo `./HelloCS` JamesJ AT JTJDEVTOOLS /cygdrive/c/Users/JamesJ/Desktop $ I guess maybe it is a different bug. I can provide binaries for these files if desired, but realistically I think anyone can compile it in MinGW, Visual C++, etc. using the C source code I posted earlier, for example. This was using an up-to-date Cygwin, and I replaced the C:\cygwin\bin\cygwin1.dll with the one from the development snapshot from 3/10/2012. Here is the source code for HelloCS program, compiled with Visual C# 2008 SP1: class Program { static void Main(string[] args) { System.Console.Write("Hello"); } } And again, here's the source code for HelloCPP program, compiled with Visual C++ 2008 SP1: #include int main() { char * test = "AB"; DWORD written; // Get standard output file handle HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); // Do a null write. This breaks Cygwin when output is redirected. WriteFile(h, test, 0, &written, NULL); // Print an "A" and a "B" in two write operations WriteFile(h, test, 1, &written, NULL); WriteFile(h, test+1, 1, &written, NULL); return 0; } Obviously, neither of these binaries were linked against any Cygwin libraries... they are just straight 100% Win32 programs... The benefit of the C version is that it removes the rest of .NET from the test... Best regards, James Johnston -----Original Message----- Sent: Monday, March 12, 2012 14:19 Subject: Re: Can't reliably redirect standard output from C# program in recent Cygwin On Mar 12 14:05, James Johnston wrote: > You're partially correct, depending on how you look at it... As I > wrote earlier, I reproduced it with a straight Win32 program, too - by > doing a null write that every C# program would do. So I guess it's > not specific to C#, since C++ programs can cause it too. But every C# > program would normally do this activity since the runtime always does > the null write - so in that sense, I guess it is somewhat specific to C#. > > Thanks all, good to know it should be fixed. :) Better test it. Please try the latest developer snapshot from http://cygwin.com/snapshots/ Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple