From ae7fefee069004a20e9931647b1d0c92ebd28abf Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Mon, 1 Jul 2024 17:42:46 +0200 Subject: [PATCH] colors: ``COLOR_RESULTS`` switched to ``False`` for non-interactive command case (#5562) ### Motivation Running commands with disabled `COLOR_RESULTS` around 40% faster. It should be by default. Closes #5561 --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- news/disable_colors_non_int.rst | 23 +++++++++++++++++++++++ xonsh/main.py | 1 + 2 files changed, 24 insertions(+) create mode 100644 news/disable_colors_non_int.rst diff --git a/news/disable_colors_non_int.rst b/news/disable_colors_non_int.rst new file mode 100644 index 000000000..510f8fcfa --- /dev/null +++ b/news/disable_colors_non_int.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* ``COLOR_RESULTS`` switched to ``False`` for non-interactive command case to improve speed in default behavior (#5562). + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/xonsh/main.py b/xonsh/main.py index 7585ca6c6..4de0d3cd3 100644 --- a/xonsh/main.py +++ b/xonsh/main.py @@ -426,6 +426,7 @@ def premain(argv=None): "XONSH_INTERACTIVE": args.force_interactive or (args.mode == XonshMode.interactive), } + pre_env["COLOR_RESULTS"] = os.getenv("COLOR_RESULTS", pre_env["XONSH_INTERACTIVE"]) # Load -DVAR=VAL arguments. if args.defines is not None: