`-e 'con'` returns 0 on Windows causing the debugger to use stdin
On Windows, checking for the existence of the special file con returns false but opening it works as expected:
if (-e "con") {
print qq[yes\n];
} else {
print qq[no\n];
}
open my $con, '<', 'con' or die qq[Can't open 'con': $!\n];
$_ = <$con>;
print qq[xx $_ xx\n];
"close $con;
produces:
no
hello
xx hello
xx
This has the effect of causing the Perl debugger (perl5db.pl) to report:
Can't figure out your console, using stdin
Which then means that a debugged program cannot redirect stdin and when an End-of-File is sent to the program while it is reading data from stdin then the debugger terminates and the program and exits.
Can the -e operator return 1 for the Windows special devices like con?
I can reproduce on 5.36 but not on 5.32.
I wonder if this is to do with the changes made to stat in 5.34? (5.33.5 is the first dev release it is in).
https://github.com/Perl/perl5/commit/92b3a3ebc05e3ce0e84a1ccff46487ca2200b471
Even if it is not, I suspect this is a perl issue rather than strawberry perl.
Also reproduced using the SP 5.34.3.1 beta release. Perl 5.34.0 is the first version with the stat changes.
I think this is an upstream problem. Either the stat tests need to special case "con" , or perl5db.pl could be updated.
The relevant line in perl5db.pl is https://github.com/Perl/perl5/blob/a20c45753ee1daf8ce4d7577ac7d88d9ff06d7b1/lib/perl5db.pl#L1546