fix(cli): use subprocess on Windows for dashboard profile re-exec (#44282) (#44446)

Co-authored-by: kyssta-exe <kyssta-exe@users.noreply.github.com>
This commit is contained in:
Kyssta 2026-06-12 10:41:39 +05:00 committed by GitHub
parent a942bfd9cc
commit 343803b23c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10368,7 +10368,16 @@ def cmd_dashboard(args):
env = os.environ.copy()
# Drop the profile HERMES_HOME so the child binds the machine root.
env.pop("HERMES_HOME", None)
os.execvpe(sys.executable, reexec_argv, env)
# On Windows, os.execvpe() does not truly replace the process — it
# spawns via CreateProcess then the parent exits. Under Python 3.14+
# this can crash with STATUS_ACCESS_VIOLATION (0xC0000005) when
# re-executing the dashboard for a non-default profile. Use
# subprocess.Popen + sys.exit() on Windows to avoid the crash.
if sys.platform == "win32":
proc = subprocess.Popen(reexec_argv, env=env)
sys.exit(proc.wait())
else:
os.execvpe(sys.executable, reexec_argv, env)
# Attach gui.log early so dashboard startup/build failures are captured in
# the same logs directory as every other Hermes surface.