diff options
Diffstat (limited to 'src/luarocks/command_line.lua')
| -rw-r--r-- | src/luarocks/command_line.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 96891b75..3f17b18a 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
| @@ -178,9 +178,19 @@ function command_line.run_command(...) | |||
| 178 | end | 178 | end |
| 179 | end | 179 | end |
| 180 | 180 | ||
| 181 | if not fs.current_dir() or fs.current_dir() == "" then | 181 | if (not fs.current_dir()) or fs.current_dir() == "" then |
| 182 | die("Current directory does not exist. Please run LuaRocks from an existing directory.") | 182 | die("Current directory does not exist. Please run LuaRocks from an existing directory.") |
| 183 | end | 183 | end |
| 184 | |||
| 185 | if fs.attributes(cfg.local_cache, "owner") ~= fs.current_user() or | ||
| 186 | fs.attributes(dir.dir_name(cfg.local_cache), "owner") ~= fs.current_user() then | ||
| 187 | util.warning("The directory '" .. cfg.local_cache .. "' or its parent directory ".. | ||
| 188 | "is not owned by the current user and the cache has been disabled. ".. | ||
| 189 | "Please check the permissions and owner of that directory. ".. | ||
| 190 | "If executing pip with sudo, you may want sudo's -H flag.") | ||
| 191 | cfg.local_cache = fs.make_temp_dir("local_cache") | ||
| 192 | util.schedule_function(fs.delete, cfg.local_cache) | ||
| 193 | end | ||
| 184 | 194 | ||
| 185 | if commands[command] then | 195 | if commands[command] then |
| 186 | local cmd = require(commands[command]) | 196 | local cmd = require(commands[command]) |
