mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(health): fix fetching url with python in provider health (#29594)
This commit is contained in:
committed by
GitHub
parent
6a886a2511
commit
5b778a64ec
@ -409,12 +409,15 @@ local function download(url)
|
|||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
elseif vim.fn.executable('python') == 1 then
|
elseif vim.fn.executable('python') == 1 then
|
||||||
local script = "try:\n\
|
local script = ([[
|
||||||
from urllib.request import urlopen\n\
|
try:
|
||||||
except ImportError:\n\
|
from urllib.request import urlopen
|
||||||
from urllib2 import urlopen\n\
|
except ImportError:
|
||||||
response = urlopen('" .. url .. "')\n\
|
from urllib2 import urlopen
|
||||||
print(response.read().decode('utf8'))\n"
|
|
||||||
|
response = urlopen('%s')
|
||||||
|
print(response.read().decode('utf8'))
|
||||||
|
]]):format(url)
|
||||||
local out, rc = system({ 'python', '-c', script })
|
local out, rc = system({ 'python', '-c', script })
|
||||||
if out == '' and rc ~= 0 then
|
if out == '' and rc ~= 0 then
|
||||||
return 'python urllib.request error: ' .. rc
|
return 'python urllib.request error: ' .. rc
|
||||||
|
Reference in New Issue
Block a user