aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-07-17 16:09:47 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-07-18 11:24:07 -0300
commit44f363fe3dcf60540b394f798f894c1ed2b26ebc (patch)
tree4a45cd6030ec7a62a34f0edd98dbdd830f8913ef /src
parente97b32988a8dbb30cb3653698c29c4bb98455b29 (diff)
downloadluarocks-44f363fe3dcf60540b394f798f894c1ed2b26ebc.tar.gz
luarocks-44f363fe3dcf60540b394f798f894c1ed2b26ebc.tar.bz2
luarocks-44f363fe3dcf60540b394f798f894c1ed2b26ebc.zip
cmd: portability fixes, don't check LuaJIT for Lua > 5.1
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cmd.lua15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua
index 9a5635c0..5af3dd95 100644
--- a/src/luarocks/cmd.lua
+++ b/src/luarocks/cmd.lua
@@ -43,18 +43,25 @@ do
43 end 43 end
44 return false 44 return false
45 end 45 end
46
47 local function Q(pathname)
48 if pathname:match("^.:") then
49 return pathname:sub(1, 2) .. '"' .. pathname:sub(3) .. '"'
50 end
51 return '"' .. pathname .. '"'
52 end
46 53
47 local function check_lua_version(lua_exe, luaver) 54 local function check_lua_version(lua_exe, luaver)
48 if not exists(lua_exe) then 55 if not exists(lua_exe) then
49 return nil 56 return nil
50 end 57 end
51 local lv = util.popen_read(lua_exe .. ' -e "io.write(_VERSION:sub(5))"') 58 local lv, err = util.popen_read(Q(lua_exe) .. ' -e "io.write(_VERSION:sub(5))"')
52 if luaver and luaver ~= lv then 59 if luaver and luaver ~= lv then
53 return nil 60 return nil
54 end 61 end
55 local ljv 62 local ljv
56 if lv == "5.1" then 63 if lv == "5.1" then
57 ljv = util.popen_read(lua_exe .. ' -e "io.write(tostring(jit and jit.version:sub(8)))"') 64 ljv = util.popen_read(Q(lua_exe) .. ' -e "io.write(tostring(jit and jit.version:sub(8)))"')
58 if ljv == "nil" then 65 if ljv == "nil" then
59 ljv = nil 66 ljv = nil
60 end 67 end
@@ -88,8 +95,10 @@ do
88 insert_lua_versions(names, v) 95 insert_lua_versions(names, v)
89 end 96 end
90 end 97 end
98 if luaver == "5.1" or not luaver then
99 table.insert(names, "luajit" .. exe_suffix)
100 end
91 table.insert(names, "lua" .. exe_suffix) 101 table.insert(names, "lua" .. exe_suffix)
92 table.insert(names, "luajit" .. exe_suffix)
93 102
94 local bindirs = { prefix .. "/bin", prefix } 103 local bindirs = { prefix .. "/bin", prefix }
95 local tried = {} 104 local tried = {}