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

File::Find on WSL

Thread Next
Thorsten Behrens
December 3, 2016 19:53
File::Find on WSL
Message ID:

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:

# Special-case for WSL by reading /proc/version
if ($^O eq 'linux') {
    open my $lv, '<', '/proc/version';
    if (index(<$lv>,'Windows') || index(<$lv>,'WSL')) {
        $File::Find::dont_use_nlink = 1;
    close $lv;

This would likely go right after the "hard-coded for now" section that handles VMS and MSWin32.

@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 Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About