Consider I have a harmless program cat.pl, which just echoes its STDIN:
And then I have a marginally more harmful program ls.pl, which feeds some input to cat.pl and reads its output:# This is cat.pl while(<>) { print; }
When I execute under Solaris or under Cygwin# This is ls.pl use strict; use warnings; use IPC::Open2; # $^X is the path to my Perl open2(*OUTPUT,*INPUT,"$^X", "cat.pl") or die "$!"; print INPUT "first line\nsecond line\n"; close INPUT; my @result=<OUTPUT>; close OUTPUT; print "RESULT:\n@result\n";
I get as outputperl ls.pl
But when I do it under Windows, the program hangs, as if it would wait indefinitely for input.RESULT: first line second line
I have no explanation for this odditiy. The only hint, that even under Solaris, respectively Cygwin, something unusual is going on, is the fact that in the (otherwise correct) output, the last line is preceded by a single space.
Any suggestion on what is going on here, and how I could get it running on Windows?In reply to ActiveState woes : Is it EOF-blind? by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |