diff options
| author | daurnimator <quae@daurnimator.com> | 2021-01-13 01:59:41 +1100 |
|---|---|---|
| committer | daurnimator <quae@daurnimator.com> | 2021-01-13 01:59:41 +1100 |
| commit | 007078e85fbf0d9d2e6d4d0390d622654e42ee49 (patch) | |
| tree | 998c76cb7153eb671ae1623b592e6ae04c31e65a /src | |
| parent | 68d558c886b4bd00f3312424d1dc804bf4576237 (diff) | |
| download | luarocks-007078e85fbf0d9d2e6d4d0390d622654e42ee49.tar.gz luarocks-007078e85fbf0d9d2e6d4d0390d622654e42ee49.tar.bz2 luarocks-007078e85fbf0d9d2e6d4d0390d622654e42ee49.zip | |
Fix running with empty PATH
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/cmd.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/cmd/path.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/core/sysdetect.lua | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua index 9077652a..c8bcb552 100644 --- a/src/luarocks/cmd.lua +++ b/src/luarocks/cmd.lua | |||
| @@ -179,7 +179,7 @@ end | |||
| 179 | local function search_lua_in_path(lua_version, verbose) | 179 | local function search_lua_in_path(lua_version, verbose) |
| 180 | local path_sep = (package.config:sub(1, 1) == "\\" and ";" or ":") | 180 | local path_sep = (package.config:sub(1, 1) == "\\" and ";" or ":") |
| 181 | local all_tried = {} | 181 | local all_tried = {} |
| 182 | for bindir in os.getenv("PATH"):gmatch("[^"..path_sep.."]+") do | 182 | for bindir in (os.getenv("PATH") or ""):gmatch("[^"..path_sep.."]+") do |
| 183 | local parentdir = dir.path((bindir:gsub("[\\/][^\\/]+[\\/]?$", ""))) | 183 | local parentdir = dir.path((bindir:gsub("[\\/][^\\/]+[\\/]?$", ""))) |
| 184 | local detected, tried = util.find_lua(parentdir, lua_version) | 184 | local detected, tried = util.find_lua(parentdir, lua_version) |
| 185 | if detected then | 185 | if detected then |
diff --git a/src/luarocks/cmd/path.lua b/src/luarocks/cmd/path.lua index 0038070b..9d6a8217 100644 --- a/src/luarocks/cmd/path.lua +++ b/src/luarocks/cmd/path.lua | |||
| @@ -45,8 +45,8 @@ function path_cmd.command(args) | |||
| 45 | return true | 45 | return true |
| 46 | end | 46 | end |
| 47 | 47 | ||
| 48 | local clean_path = util.cleanup_path(os.getenv("PATH"), path_sep, nil, true) | 48 | local clean_path = util.cleanup_path(os.getenv("PATH") or "", path_sep, nil, true) |
| 49 | 49 | ||
| 50 | if args.append then | 50 | if args.append then |
| 51 | lr_path = package.path .. ";" .. lr_path | 51 | lr_path = package.path .. ";" .. lr_path |
| 52 | lr_cpath = package.cpath .. ";" .. lr_cpath | 52 | lr_cpath = package.cpath .. ";" .. lr_cpath |
diff --git a/src/luarocks/core/sysdetect.lua b/src/luarocks/core/sysdetect.lua index 81e62076..534ab89f 100644 --- a/src/luarocks/core/sysdetect.lua +++ b/src/luarocks/core/sysdetect.lua | |||
| @@ -397,7 +397,7 @@ function sysdetect.detect(input_file) | |||
| 397 | -- interpreter path is absolute | 397 | -- interpreter path is absolute |
| 398 | table.insert(files, interp) | 398 | table.insert(files, interp) |
| 399 | else | 399 | else |
| 400 | for d in os.getenv("PATH"):gmatch("[^"..PATHsep.."]+") do | 400 | for d in (os.getenv("PATH") or ""):gmatch("[^"..PATHsep.."]+") do |
| 401 | table.insert(files, d .. dirsep .. interp) | 401 | table.insert(files, d .. dirsep .. interp) |
| 402 | end | 402 | end |
| 403 | end | 403 | end |
