aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Cichra <mikz@users.noreply.github.com>2017-09-26 10:59:38 +0200
committerHisham Muhammad <hisham@gobolinux.org>2018-03-12 21:03:50 -0300
commit3f60bec6a04eabfe1e86547f49708ea33b319849 (patch)
treef15059e3309a9e8b62823b7ac4e52c9b478840a7
parent22a7b81946edfe3e25f914c9c672b6705153714d (diff)
downloadluarocks-3f60bec6a04eabfe1e86547f49708ea33b319849.tar.gz
luarocks-3f60bec6a04eabfe1e86547f49708ea33b319849.tar.bz2
luarocks-3f60bec6a04eabfe1e86547f49708ea33b319849.zip
read just one line when checking md5
in some cases reading the whole file fails (on macOS High Sierra, LuaJIT) this is timing dependent and waiting between spawning and reading solves the issue as well
-rw-r--r--src/luarocks/fs/tools.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/luarocks/fs/tools.lua b/src/luarocks/fs/tools.lua
index 60d1d9ff..fc319af9 100644
--- a/src/luarocks/fs/tools.lua
+++ b/src/luarocks/fs/tools.lua
@@ -144,7 +144,7 @@ function tools.get_md5(file)
144 local cmd = md5_cmd[cfg.md5checker] 144 local cmd = md5_cmd[cfg.md5checker]
145 if not cmd then return nil, "no MD5 checker command configured" end 145 if not cmd then return nil, "no MD5 checker command configured" end
146 local pipe = io.popen(cmd.." "..fs.Q(fs.absolute_name(file))) 146 local pipe = io.popen(cmd.." "..fs.Q(fs.absolute_name(file)))
147 local computed = pipe:read("*a") 147 local computed = pipe:read("*l")
148 pipe:close() 148 pipe:close()
149 if computed then 149 if computed then
150 computed = computed:match("("..("%x"):rep(32)..")") 150 computed = computed:match("("..("%x"):rep(32)..")")