aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Asunkin <1353637+stasjok@users.noreply.github.com>2024-07-07 11:37:39 +0300
committerGitHub <noreply@github.com>2024-07-07 16:37:39 +0800
commit5b778a64ec2e82a7d8d28c3c36698cd42a41c539 (patch)
tree72198ac3a56d1347bae252978c7e8712b1b53a70
parent6a886a2511bbfd24a4d6ecc3f3a75f08a6df9de9 (diff)
downloadrneovim-5b778a64ec2e82a7d8d28c3c36698cd42a41c539.tar.gz
rneovim-5b778a64ec2e82a7d8d28c3c36698cd42a41c539.tar.bz2
rneovim-5b778a64ec2e82a7d8d28c3c36698cd42a41c539.zip
fix(health): fix fetching url with python in provider health (#29594)
-rw-r--r--runtime/lua/vim/provider/health.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/runtime/lua/vim/provider/health.lua b/runtime/lua/vim/provider/health.lua
index 860f839f23..9ff4d15257 100644
--- a/runtime/lua/vim/provider/health.lua
+++ b/runtime/lua/vim/provider/health.lua
@@ -409,12 +409,15 @@ local function download(url)
return out
end
elseif vim.fn.executable('python') == 1 then
- local script = "try:\n\
- from urllib.request import urlopen\n\
- except ImportError:\n\
- from urllib2 import urlopen\n\
- response = urlopen('" .. url .. "')\n\
- print(response.read().decode('utf8'))\n"
+ local script = ([[
+try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
+
+response = urlopen('%s')
+print(response.read().decode('utf8'))
+]]):format(url)
local out, rc = system({ 'python', '-c', script })
if out == '' and rc ~= 0 then
return 'python urllib.request error: ' .. rc