diff options
-rw-r--r-- | src/luarocks/cmd.lua | 15 |
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 = {} |