develooper Front page | perl.perl5.porters | Postings from November 2010

[perl #78760] Windows un-redirected system call fails from extension-launched redirected perl

From:
John Wilkinson
Date:
November 1, 2010 23:23
Subject:
[perl #78760] Windows un-redirected system call fails from extension-launched redirected perl
Message ID:
rt-3.6.HEAD-4263-1288646049-194.78760-75-0@perl.org
# New Ticket Created by  John Wilkinson 
# Please include the string:  [perl #78760]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=78760 >


All that's required is a command to run that prints to stdout.  In this example I use another Perl command, but it could be anything.

The complete redirect_fail.pl file to reproduce is then:
system('perl -e "print qq(hi) or die \$!; close(STDOUT) or die \$!;"');

It only fails if it is "extension-launched" via the .pl extension.  Ie, this fails:
C:\>redirect_fail.pl > foo.txt
Bad file descriptor at -e line 1.

But this works as expected:
C:\>c:\perl\bin\perl.exe redirect_fail.pl > foo.txt

Known to fail in both cygwin and ActiveState Perls.  Known to fail on Win 2000 and XP.  (Does not fail however on Win 2008 R2.)

Note "un-redirected system call fails" because redirected system calls work fine.  Also the backtick operator works in all tested scenarios.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About