summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-21 22:34:57 +0800
committerruki <[email protected]>2025-11-21 11:28:51 +0800
commitb793f5dd2ab1a6fdfaa862a2c2ffc99f06c1c8b5 (patch)
treec26dfc685771949b3d9fb0555927e8b8d4d84b44
parent26004160d96a301b0cc2fc739413542ed6d324d6 (diff)
improve waiting_indicator_helper
-rw-r--r--xmake/modules/async/runjobs.lua9
-rw-r--r--xmake/modules/private/action/require/impl/download_packages.lua6
-rw-r--r--xmake/modules/private/action/require/impl/install_packages.lua6
3 files changed, 14 insertions, 7 deletions
diff --git a/xmake/modules/async/runjobs.lua b/xmake/modules/async/runjobs.lua
index 1d5927e1d..5a5c73db3 100644
--- a/xmake/modules/async/runjobs.lua
+++ b/xmake/modules/async/runjobs.lua
@@ -40,7 +40,14 @@ function _init_waiting_indicator(state, opt)
-- init waiting indicator helper
-- we need to hide wait characters if is not a tty
local waiting_indicator_opt = opt.waiting_indicator
- state.show_waiting_indicator = io.isatty() and (waiting_indicator_opt == true or type(waiting_indicator_opt) == "table")
+
+ -- compatibility: support deprecated opt.progress parameter
+ if opt.progress ~= nil and waiting_indicator_opt == nil then
+ waiting_indicator_opt = opt.progress
+ wprint("opt.progress is deprecated in runjobs, use opt.waiting_indicator instead")
+ end
+
+ state.show_waiting_indicator = io.isatty() and (waiting_indicator_opt or type(waiting_indicator_opt) == "table")
state.backnum = 0
if state.show_waiting_indicator then
local indicator_opt = nil
diff --git a/xmake/modules/private/action/require/impl/download_packages.lua b/xmake/modules/private/action/require/impl/download_packages.lua
index 9536b1330..b25038672 100644
--- a/xmake/modules/private/action/require/impl/download_packages.lua
+++ b/xmake/modules/private/action/require/impl/download_packages.lua
@@ -127,7 +127,7 @@ function _download_packages(packages_download)
local term_mode_stdout = tty.term_mode("stdout")
-- do download
- local waiting_indicator_instance = show_wait and waiting_indicator.new() or nil
+ local waiting_indicator_helper = show_wait and waiting_indicator.new() or nil
local packages_downloading = {}
local packages_pending = table.copy(packages_download)
local working_count = 0
@@ -215,14 +215,14 @@ function _download_packages(packages_download)
end
-- trace
- waiting_indicator_instance:clear()
+ waiting_indicator_helper:clear()
tty.erase_line_to_start().cr()
cprintf("${yellow} => ")
if #downloading > 0 then
cprintf("downloading ${color.dump.string}%s", table.concat(downloading, ", "))
end
cprintf(" .. %s", tips and ("${dim}" .. tips .. "${clear} ") or "")
- waiting_indicator_instance:write()
+ waiting_indicator_helper:write()
end, exit = function(errors)
if errors then
tty.erase_line_to_start().cr()
diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua
index d719d1544..39d7d0bd4 100644
--- a/xmake/modules/private/action/require/impl/install_packages.lua
+++ b/xmake/modules/private/action/require/impl/install_packages.lua
@@ -414,7 +414,7 @@ function _do_install_packages(packages_install, packages_download, installdeps)
local term_mode_stdout = tty.term_mode("stdout")
-- do install
- local waiting_indicator_instance = show_wait and waiting_indicator.new() or nil
+ local waiting_indicator_helper = show_wait and waiting_indicator.new() or nil
local packages_installing = {}
local packages_downloading = {}
local packages_pending = table.copy(packages_install)
@@ -606,7 +606,7 @@ function _do_install_packages(packages_install, packages_download, installdeps)
end
-- trace
- waiting_indicator_instance:clear()
+ waiting_indicator_helper:clear()
tty.erase_line_to_start().cr()
cprintf("${yellow} => ")
if #downloading > 0 then
@@ -616,7 +616,7 @@ function _do_install_packages(packages_install, packages_download, installdeps)
cprintf("%sinstalling ${color.dump.string}%s", #downloading > 0 and ", " or "", table.concat(installing, ", "))
end
cprintf(" .. %s", tips and ("${dim}" .. tips .. "${clear} ") or "")
- waiting_indicator_instance:write()
+ waiting_indicator_helper:write()
end, exit = function(errors)
if errors then
tty.erase_line_to_start().cr()