Skip to content

Commit

Permalink
Fix loud archive unpacking
Browse files Browse the repository at this point in the history
In luarocks.fs.unix.tools.unpack_archive execute commands in quiet
mode (that is, silenced by default, but not with --verbose), like
in luarocks.fs.unzip and luarocks.fs.win32.tools.unpack_archive.
  • Loading branch information
mpeterv committed Apr 14, 2016
1 parent fde1b07 commit 6fc4b35
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/luarocks/fs/unix/tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,19 @@ end
function tools.unpack_archive(archive)
assert(type(archive) == "string")

local pipe_to_tar = " | "..vars.TAR.." -xf -"

if not cfg.verbose then
pipe_to_tar = " 2> /dev/null"..fs.quiet(pipe_to_tar)
end

local ok
if archive:match("%.tar%.gz$") or archive:match("%.tgz$") then
ok = fs.execute_string(vars.GUNZIP.." -c "..fs.Q(archive).." | "..vars.TAR.." -xf -")
ok = fs.execute_string(vars.GUNZIP.." -c "..fs.Q(archive)..pipe_to_tar)
elseif archive:match("%.tar%.bz2$") then
ok = fs.execute_string(vars.BUNZIP2.." -c "..fs.Q(archive).." | "..vars.TAR.." -xf -")
ok = fs.execute_string(vars.BUNZIP2.." -c "..fs.Q(archive)..pipe_to_tar)
elseif archive:match("%.zip$") then
ok = fs.execute(vars.UNZIP, archive)
ok = fs.execute_quiet(vars.UNZIP, archive)
elseif archive:match("%.lua$") or archive:match("%.c$") then
-- Ignore .lua and .c files; they don't need to be extracted.
return true
Expand Down

0 comments on commit 6fc4b35

Please sign in to comment.