From 1138929e64fb9d891cea370552b99bb44b31e23a Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Wed, 22 Jun 2016 20:19:57 +0300 Subject: Handle unpack_archive errors In particular, when installing a rock, fail with a message related to extraction error or unrecognized archive extension instead of 'Directory not found inside archive .'. --- src/luarocks/fetch.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index dfa6f191..824a3731 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua @@ -344,7 +344,8 @@ function fetch.get_sources(rockspec, extract, dest_dir) if extract then local ok, err = fs.change_dir(store_dir) if not ok then return nil, err end - fs.unpack_archive(rockspec.source.file) + ok, err = fs.unpack_archive(rockspec.source.file) + if not ok then return nil, err end if not fs.exists(rockspec.source.dir) then return nil, "Directory "..rockspec.source.dir.." not found inside archive "..rockspec.source.file, "source.dir", source_file, store_dir end -- cgit v1.2.3-55-g6feb