You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ja...@apache.org on 2025/10/21 01:29:27 UTC

(airflow) branch v3-1-test updated: [v3-1-test] Check for console in validate_cmd_result (#56876) (#56877)

This is an automated email from the ASF dual-hosted git repository.

jasonliu pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-1-test by this push:
     new af62beabab6 [v3-1-test] Check for console in validate_cmd_result (#56876) (#56877)
af62beabab6 is described below

commit af62beabab65c2a22284eb2a3ac5bc43b979b88f
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Tue Oct 21 09:29:19 2025 +0800

    [v3-1-test] Check for console in validate_cmd_result (#56876) (#56877)
---
 scripts/ci/prek/common_prek_utils.py | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/scripts/ci/prek/common_prek_utils.py b/scripts/ci/prek/common_prek_utils.py
index a7e01a331b8..03c22391187 100644
--- a/scripts/ci/prek/common_prek_utils.py
+++ b/scripts/ci/prek/common_prek_utils.py
@@ -276,17 +276,31 @@ def check_list_sorted(the_list: list[str], message: str, errors: list[str]) -> b
 def validate_cmd_result(cmd_result, include_ci_env_check=False):
     if include_ci_env_check:
         if cmd_result.returncode != 0 and os.environ.get("CI") != "true":
-            console.print(
-                "\n[yellow]If you see strange stacktraces above, especially about missing imports "
-                "run this command:[/]\n"
-            )
-            console.print("[magenta]breeze ci-image build --python 3.10 --upgrade-to-newer-dependencies[/]\n")
+            if console:
+                console.print(
+                    "\n[yellow]If you see strange stacktraces above, especially about missing imports "
+                    "run this command:[/]\n"
+                )
+                console.print(
+                    "[magenta]breeze ci-image build --python 3.10 --upgrade-to-newer-dependencies[/]\n"
+                )
+            else:
+                print(
+                    "\nIf you see strange stacktraces above, especially about missing imports "
+                    "run this command:\nbreeze ci-image build --python 3.10 --upgrade-to-newer-dependencies\n"
+                )
 
     elif cmd_result.returncode != 0:
-        console.print(
-            "[warning]\nIf you see strange stacktraces above, "
-            "run `breeze ci-image build --python 3.10` and try again."
-        )
+        if console:
+            console.print(
+                "[warning]\nIf you see strange stacktraces above, "
+                "run `breeze ci-image build --python 3.10` and try again."
+            )
+        else:
+            print(
+                "\nIf you see strange stacktraces above, "
+                "run `breeze ci-image build --python 3.10` and try again."
+            )
     sys.exit(cmd_result.returncode)