File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,11 +57,19 @@ local function target_triple()
5757 return arch .. " -pc-windows-msvc"
5858 elseif sysname :find (" linux" , 1 , true ) then
5959 -- Distinguish musl from glibc; the binaries are not interchangeable.
60+ -- Guard the probe: `ldd` may be absent, and a missing binary makes
61+ -- vim.system raise rather than return.
6062 local libc = " gnu"
61- local ldd = vim .system ({ " ldd" , " --version" }):wait ()
62- local out = ((ldd .stdout or " " ) .. (ldd .stderr or " " )):lower ()
63- if out :find (" musl" , 1 , true ) then
64- libc = " musl"
63+ if vim .fn .executable (" ldd" ) == 1 then
64+ local ok , ldd = pcall (function ()
65+ return vim .system ({ " ldd" , " --version" }):wait ()
66+ end )
67+ if ok and ldd then
68+ local out = ((ldd .stdout or " " ) .. (ldd .stderr or " " )):lower ()
69+ if out :find (" musl" , 1 , true ) then
70+ libc = " musl"
71+ end
72+ end
6573 end
6674 return arch .. " -unknown-linux-" .. libc
6775 end
You can’t perform that action at this time.
0 commit comments