aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElliott Slaughter <elliottslaughter@gmail.com>2020-04-16 09:43:59 -0700
committerGitHub <noreply@github.com>2020-04-16 13:43:59 -0300
commit708fed20d013e69fd79d80f0b59a45a25eed3a00 (patch)
treec39f89eb8f32c810df38cf1f6d00c140d69f06d1 /src
parent67ea6328e567fd224e7cd8ed23f55571928d7e1b (diff)
downloadluarocks-708fed20d013e69fd79d80f0b59a45a25eed3a00.tar.gz
luarocks-708fed20d013e69fd79d80f0b59a45a25eed3a00.tar.bz2
luarocks-708fed20d013e69fd79d80f0b59a45a25eed3a00.zip
Avoid uninitialized variable check, for Terra compatibility (#1182)
This patch is required to support for Terra, a language embedded in Lua/LuaJIT with support for JITing high-performance code. The only change here is that Terra uses a strict mode by default, so the attempt to access an undefined global has be wrapped in pcall to make it safe.
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/loader.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/luarocks/loader.lua b/src/luarocks/loader.lua
index 969f4844..5aa84632 100644
--- a/src/luarocks/loader.lua
+++ b/src/luarocks/loader.lua
@@ -29,7 +29,8 @@ local require = nil
29 29
30-- Workaround for wrappers produced by older versions of LuaRocks 30-- Workaround for wrappers produced by older versions of LuaRocks
31local temporary_global = false 31local temporary_global = false
32if luarocks then 32local status, luarocks_value = pcall(function() return luarocks end)
33if status and luarocks_value then
33 -- The site_config.lua file generated by old versions uses module(), 34 -- The site_config.lua file generated by old versions uses module(),
34 -- so it produces a global `luarocks` table. Since we have the table, 35 -- so it produces a global `luarocks` table. Since we have the table,
35 -- add the `loader` field to make the old wrappers happy. 36 -- add the `loader` field to make the old wrappers happy.