From aa46a3037fbd036e060fc86bfc886cc073d7e112 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 30 Oct 2025 22:50:56 +0800 Subject: improve isatty --- xmake/core/base/io.lua | 5 +++++ xmake/modules/utils/progress.lua | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/xmake/core/base/io.lua b/xmake/core/base/io.lua index d58d46297..f35c01ab3 100644 --- a/xmake/core/base/io.lua +++ b/xmake/core/base/io.lua @@ -254,6 +254,10 @@ end -- this file is a tty? function _file:isatty() + local isatty_cached = self._ISATTY + if isatty_cached ~= nil then + return isatty_cached + end -- ensure opened local ok, errors = self:_ensure_opened() @@ -266,6 +270,7 @@ function _file:isatty() if ok == nil and errors then errors = string.format("%s: %s", self, errors) end + self._ISATTY = ok return ok, errors end diff --git a/xmake/modules/utils/progress.lua b/xmake/modules/utils/progress.lua index e3094223b..223b7840a 100644 --- a/xmake/modules/utils/progress.lua +++ b/xmake/modules/utils/progress.lua @@ -269,9 +269,9 @@ function _show_progress_with_multirow_refresh(progress, format, ...) -- build and display the subprocess lines local order_lineinfos = _build_ordered_subprocess_lineinfos() - current_lineinfo.start_time = current_time _display_subprocess_lines(order_lineinfos) + current_lineinfo.start_time = current_time if is_finished then _g.refresh_mode = nil _g.progress_lineinfos = nil -- cgit v1.3.1