File tree Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Expand file tree Collapse file tree 1 file changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -235,20 +235,8 @@ function M.init()
235
235
end
236
236
237
237
--- @return boolean
238
- local function is_arm ()
239
- local fh , err = assert (io.popen (" uname -m 2>/dev/null" , " r" ))
240
- if err then
241
- logger .error (" could not determine if cpu is arm, assuming it is not: " .. err )
242
- return false -- we assume not arm
243
- end
244
-
245
- local os_name
246
- if fh then
247
- os_name = fh :read ()
248
- fh :close ()
249
- end
250
-
251
- return os_name == " aarch64" or string.sub (os_name , 1 , 3 ) == " arm"
238
+ local function is_arm (machine )
239
+ return machine == " aarch64" or machine :sub (1 , 3 ) == " arm"
252
240
end
253
241
254
242
--- @return boolean
@@ -298,9 +286,10 @@ function M.get_copilot_server_info()
298
286
local path = " "
299
287
local extracted_filename = " copilot-language-server"
300
288
local filename = " copilot-language-server-" .. copilot_version
301
- local os = vim .loop .os_uname ().sysname
289
+ local uname = vim .loop .os_uname ()
290
+ local os = uname .sysname
302
291
if os == " Linux" then
303
- if is_arm () then
292
+ if is_arm (uname . machine ) then
304
293
path = " linux-arm64"
305
294
elseif not is_musl () then
306
295
path = " linux-x64"
@@ -309,7 +298,7 @@ function M.get_copilot_server_info()
309
298
path = " js"
310
299
end
311
300
elseif os == " Darwin" then
312
- if is_arm () then
301
+ if is_arm (uname . machine ) then
313
302
path = " darwin-arm64"
314
303
else
315
304
path = " darwin-x64"
You can’t perform that action at this time.
0 commit comments