From 885266ffb0f7a22b5f426e591c714bf4e7d5c0f9 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Thu, 23 Apr 2026 11:03:32 +0200 Subject: [PATCH] open_url_in_browser: Surround subprocess creation with try-catch Resolves #1363 --- src/serena/dashboard.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/serena/dashboard.py b/src/serena/dashboard.py index d2f5e1fa..9a35806c 100644 --- a/src/serena/dashboard.py +++ b/src/serena/dashboard.py @@ -800,13 +800,18 @@ def open_url_in_browser(url: str, use_subprocess: bool = False) -> None: """ if use_subprocess: # Use a subprocess to avoid any output from webbrowser.open being written to stdout - subprocess.Popen( - [sys.executable, "-c", f"import webbrowser; webbrowser.open({url!r})"], - stdin=subprocess.DEVNULL, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, - start_new_session=False, - ) + try: + subprocess.Popen( + [sys.executable, "-c", f"import webbrowser; webbrowser.open({url!r})"], + stdin=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + start_new_session=False, + ) + except Exception as e: + # Subprocess creation can fail in rare cases (e.g. on some Linux systems; possibly subprocess/glibc bug) + # See #1363 + log.error("Failed to open URL (%s) in subprocess; %s", url, e) else: import webbrowser