develooper Front page | perl.perl5.porters | Postings from February 2004

Re: [perl #25369] perlbug: 5.8.2 ActivePerl $CHILD_ERROR wrong with 2>&1 after qx

Thread Previous
From:
Randy W. Sims
Date:
February 1, 2004 10:06
Subject:
Re: [perl #25369] perlbug: 5.8.2 ActivePerl $CHILD_ERROR wrong with 2>&1 after qx
Message ID:
401D3F00.2090301@ThePierianSpring.org
On 2/1/2004 6:22 AM, Yitzchak Scott-Thoennes wrote:

> On Sat, Jan 31, 2004 at 10:33:42PM +0000, Dave Mitchell <davem@fdisolutions.com> wrote:
> 
>>On Tue, Jan 27, 2004 at 06:41:45PM -0000, Flash Sheridan wrote:
>>
>>>-----------------------------------------------------------------
>>>The following code incorrectly prints -1 under Perl v5.8.2 build 808, but 
>>>correctly prints 0 for 5.6.1 build 631, with CygWin true.
>>>     CygWin's true is working correctly, as verified by echo %ERRORLEVEL%; 
>>>I originally noticed the problem with
>>>an internal tool.  More complicated code relying on the expected behavior 
>>>has been working for over a year.
>>>     Because of ActiveState's warning about dual installations, I haven't 
>>>yet tried both versions of Perl on the same machine;
>>>     the bug is on a new Windows XP box.
>>>
>>>
>>>use strict; use warnings; use diagnostics; use English; use 5.6.0;
>>>my $theSysText = qx("true 2>&1");
>>>print "\nCHILD_ERROR: $CHILD_ERROR\n";
>>
>>First, a disclaimer - I don't use Windows, so some of the following is
>>speculative. However, the '2>&1' syntax is specific to UNIX (Bourne-like)
>>shells, and is unlikely to work under Windows. A return code of -1
>>usually means that Perl was unable to execute the command. For example on
>>my Linux system:
>>
>>$ ./perl -e '$a=`/xxx`; print "\$?=$? \$a=[$a] \$!=[$!]\n"'
>>$?=-1 $a=[] $!=[No such file or directory]
>>
>>Try printing out $! to see what the error is, then see if the problem goes
>>away by removing the 2>&1.
> 
> 
> Did perl get smarter about not invoking a shell when doing "foo 2>&1"
> between those two versions?
> 
> If so, it may be that true is not in the path, and the error was hidden
> (because $? was the return code of the shell, not of true) under 5.6.1.

He's using Windows XP. The Windows 2000 & XP shell ('cmd.exe') does 
understand that syntax.

> I'm curious about this "activestate warning" about dual installations,
> do you have a link to it?

I /think/ that that has to do with same major versions of perl because 
ActiveState stores the lib directories in the registry. I have multiple 
installation on my Windows boxes by deleting the registry entries and 
setting the PATH & PERLLIB variables to the perl I want to use.

Randy.




Thread Previous


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