Open p5pRT opened 6 years ago
For this simple one-liner perl -e "open A\, 'dir|';print $?" different perl versions on Win32 mostly output -1 but not all (5.8.4 outputs 0)
D:\apps\perl-old\perl584\bin>perl -e "open A\, 'dir|';print $?" 0 D:\apps\perl-old\perl5121\bin>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-old\perl-5.16.0>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-old\perl-5-004-02>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-old\perl5_005_03>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-old\perl561>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-5.28.0\perl\bin>perl -e "open A\, 'dir|';print $?" -1
on Cygwin this outputs 0 as expected\, as well as on linux freebsd etc
reading "perldoc perlvar" gives me think that it should output 0
On Tue\, 21 Aug 2018 13:06:20 -0700\, Vadim.Konovalov@dell.com wrote:
For this simple one-liner perl -e "open A\, 'dir|';print $?" different perl versions on Win32 mostly output -1 but not all (5.8.4 outputs 0)
D:\apps\perl-old\perl584\bin>perl -e "open A\, 'dir|';print $?" 0 D:\apps\perl-old\perl5121\bin>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-old\perl-5.16.0>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-old\perl-5-004-02>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-old\perl5_005_03>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-old\perl561>perl -e "open A\, 'dir|';print $?" -1 D:\apps\perl-5.28.0\perl\bin>perl -e "open A\, 'dir|';print $?" -1
on Cygwin this outputs 0 as expected\, as well as on linux freebsd etc
reading "perldoc perlvar" gives me think that it should output 0
Possibly introduced (at least for NT-ish systems) by 40c7cc6dda502ce0119863824290b6aa3c979bb0.
I don't see anything in the documentation for open() nor for $? indicating that $? is modified by open()\, nor that it's modified by open.
The behaviour you're seeing on Linux isn't that open is setting $? to 0\, it just isn't touching it:
$ perl -le '$? = -1; open F\, "ls |"; print $?' -1
So perhaps pp_open() should be preserving PL_statusvalue ($?).
Not that I can see much reason for you to be checking $? after a successful open.
Tony
The RT System itself - Status changed from 'new' to 'open'
Migrated from rt.perl.org#133463 (status was 'open')
Searchable as RT133463$