Files
FreeCADWasmDev/contrib/.vscode/scripts/VSCodeAutostartDebug.FCMacro
wangdequan b5a086fda5
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled
FreeCAD WebAssembly development snapshot
2026-08-20 07:00:53 +08:00

23 lines
1.2 KiB
Plaintext

import debugpy
from multiprocessing.connection import Listener
from freecad.utils import get_python_exe
# get_python_exe is needed because debugpy needs a python interpreter to work.
# It does not have to be FC embedded interpreter.
# By default it attempts to use Freecad's PID mistaking it for python.
# https://github.com/microsoft/debugpy/issues/262
debugpy.configure(python=get_python_exe())
# As of Python 3.12, debugpy runs a forwarding process that listens both on the port specified here for the debugger
# to connect to, but also on an internal port for the underlying pydevd within the python process to connect to. The
# default for that internal port is 5678, so we need to not duplicate it for the external port. Also, on Linux the
# attempt to spawn the forwarding process separately fails, so we force it to be internal to our main process.
debugpy.listen(('localhost', 5679),in_process_debug_adapter=True)
# Turns out you cannot probe debugpy to see if it is up:
# https://github.com/microsoft/debugpy/issues/974
# Open another port that the script WaitForDebugpy can probe to see if
# debugpy is running
listener = Listener(('localhost', 39999), backlog=10)
debugpy.wait_for_client()