mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-25 00:44:52 +01:00
fix: try with uv.spawn powershell.exe for win
ohh windows always so much fun.....
This commit is contained in:
parent
81baba98db
commit
646760f3cb
1 changed files with 19 additions and 8 deletions
25
build.lua
25
build.lua
|
@ -31,15 +31,26 @@ local native_path = plugin_dir..sep.."lua"..sep.."codemp"..sep.."new-native."..e
|
|||
local replace_native_path = plugin_dir..sep.."lua"..sep.."codemp"..sep.."native."..ext
|
||||
local download_url_native = string.format("https://codemp.dev/releases/lua/codemp-lua-%s-%s.%s", arch, platform, ext)
|
||||
|
||||
local command = {
|
||||
Windows_NT = { "Invoke-WebRequest", download_url_native, "-OutFile", native_path },
|
||||
Linux = {"curl", "-o", native_path, download_url_native },
|
||||
Mac = {"curl", "-o", native_path, download_url_native },
|
||||
}
|
||||
|
||||
print("downloading codemp native lua extension from '" .. download_url_native .. "' ...")
|
||||
vim.system(command[os_uname.sysname]):wait() -- TODO can we run this asynchronously?
|
||||
if os_uname.sysname == "Windows_NT" then
|
||||
local handle, pid = vim.uv.spawn("powershell.exe", {
|
||||
args = { "-Command", "Invoke-WebRequest "..download_url_native.." -OutFile "..native_path }
|
||||
})
|
||||
|
||||
print("downloading in background... library will be installed upon restart")
|
||||
else
|
||||
local res = vim.system({"curl", "-o", native_path, download_url_native }):wait() -- TODO can we run this asynchronously?
|
||||
print(res.stdout)
|
||||
print(res.stderr)
|
||||
print(">> " .. res.code)
|
||||
if res.code == 0 then
|
||||
print("downloaded! exit nvim to reload library")
|
||||
else
|
||||
print("error downloading native library: " .. res.code)
|
||||
print(res.stdout)
|
||||
print(res.stderr)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd(
|
||||
{"ExitPre"},
|
||||
|
|
Loading…
Reference in a new issue