diff options
Diffstat (limited to 'luarocks/src/luarocks/fs/win32/tools.lua')
-rw-r--r-- | luarocks/src/luarocks/fs/win32/tools.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/luarocks/src/luarocks/fs/win32/tools.lua b/luarocks/src/luarocks/fs/win32/tools.lua index f970f36..b9dce85 100644 --- a/luarocks/src/luarocks/fs/win32/tools.lua +++ b/luarocks/src/luarocks/fs/win32/tools.lua @@ -39,7 +39,7 @@ end function tools.current_dir() local current = cfg.cache_pwd if not current then - local pipe = io.popen(fs.Q(vars.PWD)) + local pipe = io.popen(fs.Q(vars.PWD).. " 2> NUL") current = pipe:read("*l") pipe:close() cfg.cache_pwd = current @@ -56,7 +56,9 @@ end -- @return boolean: true if command succeeds (status code 0), false -- otherwise. function tools.execute_string(cmd) - cmd = command_at(fs.current_dir(), cmd) + local current = fs.current_dir() + if not current then return false end + cmd = command_at(current, cmd) local code = os.execute(cmd) if code == 0 or code == true then return true @@ -149,7 +151,7 @@ end -- plus an error message. function tools.copy_contents(src, dest) assert(src and dest) - if fs.execute_quiet(fs.Q(vars.CP).." -dR "..src.."\\*.* "..fs.Q(dest)) then + if fs.execute_quiet(fs.Q(vars.CP), "-dR", src.."\\*.*", dest) then return true else return false, "Failed copying "..src.." to "..dest @@ -256,7 +258,7 @@ function tools.use_downloader(url, filename, cache) local ok if cfg.downloader == "wget" then - local wget_cmd = fs.Q(vars.WGET).." --no-check-certificate --no-cache --user-agent=\""..cfg.user_agent.." via wget\" --quiet " + local wget_cmd = fs.Q(vars.WGET).." "..vars.WGETNOCERTFLAG.." --no-cache --user-agent=\""..cfg.user_agent.." via wget\" --quiet " if cfg.connection_timeout and cfg.connection_timeout > 0 then wget_cmd = wget_cmd .. "--timeout="..tonumber(cfg.connection_timeout).." --tries=1 " end @@ -272,7 +274,7 @@ function tools.use_downloader(url, filename, cache) ok = fs.execute_quiet(wget_cmd, url) end elseif cfg.downloader == "curl" then - local curl_cmd = vars.CURL.." -f -k -L --user-agent \""..cfg.user_agent.." via curl\" " + local curl_cmd = fs.Q(vars.CURL).." "..vars.CURLNOCERTFLAG.." -f -L --user-agent \""..cfg.user_agent.." via curl\" " if cfg.connection_timeout and cfg.connection_timeout > 0 then curl_cmd = curl_cmd .. "--connect-timeout "..tonumber(cfg.connection_timeout).." " end |