>On 2012-04-19 16:14, Christopher Faylor wrote:
>> On Thu, Apr 19, 2012 at 12:56:33PM +0100, somebody wrote:
>>> Hi all,
>>>
>>> This started in 1.7.10 and I thought this may be fixed in 1.7.12 due
>>> to emails in the mailing list:
>>> http://sourceware.org/ml/cygwin/2012-03/msg00666.html
>>>
>>> But there still seems to be a problem piping from a .net console
>>> application to a visual c++ console application.
>>>
>>> Using the following simple C# program complied using "csc /optimize
>>> /target:exe /out:./consoleout.exe Program.cs"
>>>
>>>>>>> Begin Program.cs
>>> namespace consoleout
>>> {
>>>    using System;
>>>
>>>    internal static class Program
>>>    {
>>>        private static void Main(string[] args)
>>>        {
>>>            foreach (var arg in args) {
>>>                Console.Out.WriteLine(arg);
>>>            }
>>>        }
>>>    }
>>> }
>>> <<<< End Program.cs
>>>
>>> I can use this to output to cygwin exes OK
>>> $ ./consoleout.exe Hello There | cat
>>> Hello
>>> There
>>> $ ./consoleout.exe Hello There | grep ll
>>> 1:Hello
>>> $
>>>
>>> I also created a visual c++ executable like the simple one below
>>> compiled with "cl /EHs readin.cxx /link"
>>>
>>>>>>> Begin readin.cxx
>>> #include <string>
>>> #include <iostream>
>>>
>>> int
>>> main(int argc, char** argv)
>>> {
>>>    static_cast<void>(argc);
>>>    static_cast<void>(argv);
>>>    std::string buf;
>>>    buf.reserve(1024);
>>>    while (std::getline(std::cin, buf, '\n')) {
>>>        std::cout << buf << '\n';
>>>    }
>>>    return EXIT_SUCCESS;
>>> }
>>> <<<< End readin.cxx
>>>
>>> I can use this to output anything read in
>>> $ echo Hello | ./readin.exe
>>> Hello
>>> $ cat 'readin.cxx' | ./readin.exe
>>> #include <string>
>>> #include <iostream>
>>>
>>> int
>>> main(int argc, char** argv)
>>> {
>>>    static_cast<void>(argc);
>>>    static_cast<void>(argv);
>>>    std::string buf;
>>>    buf.reserve(1024);
>>>    while (std::getline(std::cin, buf, '\n')) {
>>>        std::cout << buf << '\n';
>>>    }
>>>    return EXIT_SUCCESS;
>>> }
>>> $
>>>
>>> But when combining the two, nothing happens.
>>> $ ./consoleout.exe Hello There | ./readin.exe
>>> $
>>>
>>> It "seems" as though the console out from the .net is not being
>>> correctly piped through to a vc++ program. I know that is a strange
>>> defect given all the other combinations work.
>>>
>>> The reverse works i.e. output from a visual c++ console application is
>>> piped correctly to a .net console application.
>>>
>>> This worked prior to 1.7.10 (1.7.9 and before).
>>>
>>> I am sorry that I cannot point to an area in the Cygwin code or
>>> suggest a fix, but I am hoping this is enough of a description to help
>>> someone find out what the issue is.
>>
>> Sorry but I'm not going to set up a .NET development environment to
>> figure out a problem.  If someone else wants to provide a clue as
>> to what's going on, I'd appreciate it.
>
> I'll bite, and it WJFFM...
>
> $ ./consoleout hello world | ./readin
> hello
> world
> $ uname -a
> CYGWIN_NT-6.1-WOW64 PEDA-PC 1.7.13(0.260/5/3) 2012-04-05 12:43 i686 Cygwin>
>
> To stress it a tiny bit more:
> $ ./consoleout hello world | ./readin | ./readin | ./readin | ./readin
> hello
> world
> $ ./consoleout hello world | ./readin | ./readin | grep rl | ./readin | 
> ./readin
> world
>
> Question for the OP: Does the pipe work from a cmd prompt?
>
> Cheers,
> Peter

Strange, I am using mintty and tcsh. It also fails for me in cmd/bash,
cmd/tcsh, mintty/bash.
It does work with straight forward cmd prompt, no cygwin shells. I am
using 32bit windows 7 though, not sure if that helps.
$ uname -a
CYGWIN_NT-6.1 F1N6LQ1 1.7.13(0.260/5/3) 2012-04-05 12:43 i686 Cygwin

Perhaps a little bit more about development environment?
Using VS2010 C# 4.0 (VS2008 fails to work as well using C# 3.0 and C# 2.0)

OK, while writing this I did test this on a 64bit windows and I get
the same result, no output from readin.

My original post has the cygcheck output, is there any major
difference between your configuration and mine there? I am more than
happy to try out various options that might fix or even help work out
what is going on.


Alan

--
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

Reply via email to