Skip to content

Commit a078c87

Browse files
committed
fix: alpine linux detection
1 parent 1714f3a commit a078c87

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lua/blink/cmp/fuzzy/download.lua

+4-7
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ function download.get_system_triple(cb)
140140
elseif jit.os:lower() == 'windows' then
141141
if jit.arch:lower():match('x64') then return cb('x86_64-pc-windows-msvc') end
142142
elseif jit.os:lower() == 'linux' then
143-
vim.system({ 'uname', '-a' }, {}, function(out)
144-
local libc = 'gnu'
145-
if out.stdout:lower():match('alpine') then libc = 'musl' end
146-
143+
vim.uv.fs_stat('/etc/alpine-release', function(err, is_alpine)
144+
local libc = (not err and is_alpine) and 'musl' or 'gnu'
147145
if jit.arch:lower():match('arm') then return cb('aarch64-unknown-linux-' .. libc) end
148146
if jit.arch:lower():match('x64') then return cb('x86_64-unknown-linux-' .. libc) end
149147
return cb(nil)
@@ -162,9 +160,8 @@ function download.get_system_triple_sync()
162160
elseif jit.os:lower() == 'windows' then
163161
if jit.arch:lower():match('x64') then return 'x86_64-pc-windows-msvc' end
164162
elseif jit.os:lower() == 'linux' then
165-
local libc = 'gnu'
166-
local out = vim.system({ 'uname', '-a' }, {}):wait()
167-
if out.stdout:lower():match('alpine') then libc = 'musl' end
163+
local success, is_alpine = pcall(vim.uv.fs_stat, '/etc/alpine-release')
164+
local libc = (success and is_alpine) and 'musl' or 'gnu'
168165

169166
if jit.arch:lower():match('arm') then return 'aarch64-unknown-linux-' .. libc end
170167
if jit.arch:lower():match('x64') then return 'x86_64-unknown-linux-' .. libc end

0 commit comments

Comments
 (0)