develooper Front page | perl.perl5.porters | Postings from December 2016

RE: File::Find on WSL

Thread Previous | Thread Next
Thorsten Behrens
December 3, 2016 20:25
RE: File::Find on WSL
Message ID:
I need to apologize. My heart's in the right place, my coding skills are not, and I'm spamming you. The code I sent so far is nonsense. That's not how index() works. This, after some testing, works. Attempt #3:

As per discussion here, WSL confuses File::Find. WSL is the "Windows Subsystem for Linux", which runs Ubuntu on top of Windows 10.

File::Find sees that $^O is 'linux' and uses nlink, which doesn't work. After some discussion, this code added to special-cases for WSL and solves the issue:

# These are hard-coded for now, but may move to hint files.
if ($^O eq 'VMS') {
    $Is_VMS = 1;
    $File::Find::dont_use_nlink  = 1;
elsif ($^O eq 'MSWin32') {
    $Is_Win32 = 1;
elsif ($^O eq 'linux') {
    open my $lv, '<', '/proc/version';
    if (index(<$lv>,'Microsoft') != -1 || index(<$lv>,'WSL') != -1) {
        $File::Find::dont_use_nlink = 1;
    close $lv;

@genio kindly pointed me to this mailing list for further discussion. If that code above is acceptable, I can follow instructions in and issue a pull request.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About