In perl.git, the branch smoke-me/jkeenan/130258-file-find-wls has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/b5d3735edaf1ce4d6df342a84098adf26cb828ec?hp=02bf7330deeaa5dbc41d5c6d89a80d2c31e08c6b> - Log ----------------------------------------------------------------- commit b5d3735edaf1ce4d6df342a84098adf26cb828ec Author: James E Keenan <[email protected]> Date: Sun Dec 4 16:52:25 2016 -0500 Don't die if unable to open /proc/version. As some Linuxes may not have that file. ----------------------------------------------------------------------- Summary of changes: ext/File-Find/lib/File/Find.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ext/File-Find/lib/File/Find.pm b/ext/File-Find/lib/File/Find.pm index 67668e837d..822868dd08 100644 --- a/ext/File-Find/lib/File/Find.pm +++ b/ext/File-Find/lib/File/Find.pm @@ -777,16 +777,17 @@ $File::Find::current_dir = File::Spec->curdir || '.'; sub _microsoft_wsl_check { return 0 unless $^O eq 'linux'; - open my $pv, '<', '/proc/version' or die "Can't open < /proc/version: $!"; - # Expecting /proc/version to look like this: - # Linux version 3.4.0-Microsoft ([email protected]) (gcc version 4.7 (GCC) ) #1 SMP PREEMPT Wed Dec 31 14:42:53 PST 2014 - my $lv = <$pv>; + if (open my $pv, '<', '/proc/version') { + # Expecting /proc/version to look like this: + # Linux version 3.4.0-Microsoft ([email protected]) (gcc version 4.7 (GCC) ) #1 SMP PREEMPT Wed Dec 31 14:42:53 PST 2014 + my $lv = <$pv>; - # If we locate either 'Microsoft' or 'WSL' (Windows Subsystem for Linux) - # in the string, we infer that we are on WSL. See: - # https://msdn.microsoft.com/en-us/commandline/wsl/about + # If we locate either 'Microsoft' or 'WSL' (Windows Subsystem for Linux) + # in the string, we infer that we are on WSL. See: + # https://msdn.microsoft.com/en-us/commandline/wsl/about - return 1 if (index($lv,'Microsoft') != -1 || index($lv,'WSL') != -1); + return 1 if (index($lv,'Microsoft') != -1 || index($lv,'WSL') != -1); + } return 0; } -- Perl5 Master Repository
