summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-03 22:52:05 +0800
committerruki <[email protected]>2026-03-03 22:52:05 +0800
commit78ee1e41654471d13288d56747276a2c8379cf67 (patch)
treee5de077307913dc1cf29fdeb73d34bdb2ec76bf7
parent28f8b6894830f05dd3f5c741a988055d27514ee2 (diff)
improve to detect -k for gzip
-rw-r--r--xmake/modules/utils/archive/archive.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/xmake/modules/utils/archive/archive.lua b/xmake/modules/utils/archive/archive.lua
index 1d09da989..96d369012 100644
--- a/xmake/modules/utils/archive/archive.lua
+++ b/xmake/modules/utils/archive/archive.lua
@@ -199,8 +199,10 @@ function _archive_using_gzip(archivefile, inputfiles, extension, opt)
local argv = {"-c", archivefile}
local keep = _g.gzip_keep
if keep == nil then
+ -- https://github.com/xmake-io/xmake/issues/7361
keep = try {function ()
- local result = os.iorunv(gzip.program, {"--help"})
+ local outdata, errdata = os.iorunv(gzip.program, {"--help"})
+ local result = (outdata or "") .. (errdata or "")
if result and (result:find(" -k", 1, true) or result:find("--keep", 1, true)) then
return true
end
@@ -265,7 +267,8 @@ function _archive_using_tar(archivefile, inputfiles, extension, opt)
local force_local = _g.force_local
if force_local == nil then
force_local = try {function ()
- local result = os.iorunv(program, {"--help"})
+ local outdata, errdata = os.iorunv(program, {"--help"})
+ local result = (outdata or "") .. (errdata or "")
if result and result:find("--force-local", 1, true) then
return true
end