From 940814172ac2cd6c150b67d669ae7f8fc2bcdca7 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Wed, 3 Apr 2024 15:41:42 +0200 Subject: [PATCH] fix(cli): don't show a stack trace when command + c of the CLI --- playwright/__main__.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/playwright/__main__.py b/playwright/__main__.py index a5dfdad40..b38ae8a95 100644 --- a/playwright/__main__.py +++ b/playwright/__main__.py @@ -19,11 +19,14 @@ def main() -> None: - driver_executable, driver_cli = compute_driver_executable() - completed_process = subprocess.run( - [driver_executable, driver_cli, *sys.argv[1:]], env=get_driver_env() - ) - sys.exit(completed_process.returncode) + try: + driver_executable, driver_cli = compute_driver_executable() + completed_process = subprocess.run( + [driver_executable, driver_cli, *sys.argv[1:]], env=get_driver_env() + ) + sys.exit(completed_process.returncode) + except KeyboardInterrupt: + sys.exit(130) if __name__ == "__main__":