From 2d3313ba1a2aa40350be90d52082f2e0f2cfedb4 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 30 Apr 2022 21:54:19 +0800 Subject: fix colors broken --- .../modules/private/action/require/impl/install_packages.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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}) -- cgit v1.3.1