Front page | perl.perl5.porters |
Postings from December 2016
Re: File::Find on WSL
Thread Previous
|
Thread Next
From:
Sawyer X
Date:
December 6, 2016 20:20
Subject:
Re: File::Find on WSL
Message ID:
5351bde8-93e8-7610-29c1-683e0d1cdf5e@gmail.com
Thorsten, thank you for raising this issue and working on solving it! :)
On 12/04/2016 01:29 PM, Leon Timmermans wrote:
> On Sun, Dec 4, 2016 at 5:12 AM, Uri Guttman <uri@stemsystems.com
> <mailto:uri@stemsystems.com>> wrote:
>
> do you want that to be a warn or a die? i would call die as that
> means the $^O is misleading or something made /proc/version
> disappear. a warning does little good there as the typical caller
> of file::find won't understand what is wrong.
>
>
> It is possible (but unusual) for /proc not to exist.
That's what I remembered too.
I see a very narrow problem scope here: If it's WSL and there is no
/proc/version or the /proc/version is wrong. If WSL guarantees to have
/proc/version existing and set to the right value, then there's no
reason to die or warn. It becomes this simple "best effort" statement:
if ( $^O eq 'linux' && open my $fh, '<', '/proc/version' ) {
my $line = <$fh>;
$line =~ /(Microsoft|WSL)/
and $File::Find::dont_use_nlink = 1;
close $fh
or die "Cannot close /proc/version: $!\n";
}
(Pending any bike-shedding on the actual code - I have no opinion.)
(The $^O check can be a separate condition, so other non-WSL statement
could go there too in the future, for example.)
Do I understand this correctly?
Thread Previous
|
Thread Next