aboutsummaryrefslogtreecommitdiff
path: root/src/luarocks/cfg.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/cfg.lua')
-rw-r--r--src/luarocks/cfg.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 2904146b..87777b86 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -35,6 +35,21 @@ major_version = program_version:match("([^.]%.[^.])")
35 35
36local persist = require("luarocks.persist") 36local persist = require("luarocks.persist")
37 37
38_M.errorcodes = setmetatable({
39 OK = 0,
40 UNSPECIFIED = 1,
41 PERMISSIONDENIED = 2,
42},{
43 __index = function(t, key)
44 local val = rawget(t, key)
45 if not val then
46 error("'"..tostring(key).."' is not a valid errorcode", 2)
47 end
48 return val
49 end
50})
51
52
38local popen_ok, popen_result = pcall(io.popen, "") 53local popen_ok, popen_result = pcall(io.popen, "")
39if popen_ok then 54if popen_ok then
40 if popen_result then 55 if popen_result then
@@ -43,7 +58,7 @@ if popen_ok then
43else 58else
44 io.stderr:write("Your version of Lua does not support io.popen,\n") 59 io.stderr:write("Your version of Lua does not support io.popen,\n")
45 io.stderr:write("which is required by LuaRocks. Please check your Lua installation.\n") 60 io.stderr:write("which is required by LuaRocks. Please check your Lua installation.\n")
46 os.exit(1) 61 os.exit(_M.errorcodes.UNSPECIFIED)
47end 62end
48 63
49-- System detection: 64-- System detection: