From 1dbf000905f2b2ff80f8ea51c1930c6d896fcf61 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 8 Sep 2025 17:17:36 -0400 Subject: [PATCH] Avoid python stack traces when hitting ^C in autoupdate (#6004) Currently hitting ^C prints out two stack traces, requiring scrolling up though multiple screens of scrollback to get back to the autoupdate results. This primarily shows up when hitting ^C while it's symbolizing a C++ stack trace. --- scripts/run_bazel.py | 6 +++++- toolchain/autoupdate_testdata.py | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/run_bazel.py b/scripts/run_bazel.py index c3361d3c556a..6873ef80af4e 100755 --- a/scripts/run_bazel.py +++ b/scripts/run_bazel.py @@ -14,6 +14,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception import argparse import subprocess +import sys import time import scripts_utils @@ -82,4 +83,7 @@ def main() -> None: if __name__ == "__main__": - main() + try: + main() + except KeyboardInterrupt: + sys.exit(1) diff --git a/toolchain/autoupdate_testdata.py b/toolchain/autoupdate_testdata.py index f794f3492524..5aa57c43cdab 100755 --- a/toolchain/autoupdate_testdata.py +++ b/toolchain/autoupdate_testdata.py @@ -96,4 +96,7 @@ def main() -> None: if __name__ == "__main__": - main() + try: + main() + except KeyboardInterrupt: + sys.exit(1)