summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-30 21:54:19 +0800
committerruki <[email protected]>2022-04-30 21:54:19 +0800
commit2d3313ba1a2aa40350be90d52082f2e0f2cfedb4 (patch)
treebc001202b0188b2a91cdf2dfe72c62887fb50660
parent3c081be3b42a8ac2a9454a34c6ec299dfe423d55 (diff)
fix colors broken
-rw-r--r--xmake/modules/private/action/require/impl/install_packages.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua
index e2b2ebf7b..2b99076cd 100644
--- a/xmake/modules/private/action/require/impl/install_packages.lua
+++ b/xmake/modules/private/action/require/impl/install_packages.lua
@@ -540,6 +540,9 @@ function main(requires, opt)
_sort_packages_for_installdeps(packages, installdeps, order_packages)
packages = table.unique(order_packages)
+ -- save terminal mode for stdout
+ local term_mode_stdout = tty.term_mode("stdout")
+
-- fetch and register packages (with system) from local first
runjobs("fetch_packages", function (index)
local instance = packages[index]
@@ -551,6 +554,15 @@ function main(requires, opt)
instance:fetch()
os.setenvs(oldenvs)
end
+
+ -- fix terminal mode to avoid some subprocess to change it
+ --
+ -- @see https://github.com/xmake-io/xmake/issues/1924
+ -- https://github.com/xmake-io/xmake/issues/2329
+ if term_mode_stdout ~= tty.term_mode("stdout") then
+ tty.term_mode("stdout", term_mode_stdout)
+ end
+
end, {total = #packages,
comax = (option.get("verbose") or option.get("diagnosis")) and 1 or 4,
isolate = true})