fix(eval): fix has('wsl') #16153

Problem:
has('wsl') is decided at build-time.

Solution:
Check os_uname().
Fixes #12642, #16143
This commit is contained in:
erw7
2021-10-30 08:55:32 +09:00
committed by GitHub
parent ac358bfb2f
commit 16d06fa3eb
4 changed files with 26 additions and 13 deletions

View File

@@ -59,7 +59,12 @@ describe('has()', function()
end)
it('"wsl"', function()
if 1 == funcs.has('win32') or 1 == funcs.has('mac') then
local luv = require('luv')
local is_wsl =
luv.os_uname()['release']:lower():match('microsoft') and true or false
if is_wsl then
eq(1, funcs.has('wsl'))
else
eq(0, funcs.has('wsl'))
end
end)