From a7bda31a720167607f608ba02a7b151bb744c28e Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 13 Mar 2018 11:48:07 -0300 Subject: Use posix.mkdtemp conditionally Closes #677. --- src/luarocks/fs/lua.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 8fe2466c..89426b09 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua @@ -9,7 +9,6 @@ local fs = require("luarocks.fs") local cfg = require("luarocks.core.cfg") local dir = require("luarocks.dir") local util = require("luarocks.util") -local path = require("luarocks.path") local socket_ok, zip_ok, unzip_ok, lfs_ok, md5_ok, posix_ok, _ local http, ftp, lrzip, luazip, lfs, md5, posix @@ -788,6 +787,9 @@ function fs_lua.current_user() return posix.getpwuid(posix.geteuid()).pw_name end +-- This call is not available on all systems, see #677 +if posix.mkdtemp then + --- Create a temporary directory. -- @param name string: name pattern to use for avoiding conflicts -- when creating temporary directory. @@ -799,6 +801,8 @@ function fs_lua.make_temp_dir(name) return posix.mkdtemp((os.getenv("TMPDIR") or "/tmp") .. "/luarocks_" .. name:gsub("/", "_") .. "-XXXXXX") end +end -- if posix.mkdtemp + end --------------------------------------------------------------------- -- cgit v1.2.3-55-g6feb