Tweak VSCode debug port to work with current versions
This commit is contained in:
2
contrib/.vscode/launch.json
vendored
2
contrib/.vscode/launch.json
vendored
@@ -66,7 +66,7 @@
|
||||
"redirectOutput": true,
|
||||
"connect": {
|
||||
"host": "localhost",
|
||||
"port": 5678
|
||||
"port": 5679
|
||||
},
|
||||
"pathMappings": [
|
||||
{
|
||||
|
||||
@@ -7,7 +7,11 @@ from freecad.utils import get_python_exe
|
||||
# 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())
|
||||
debugpy.listen(('localhost', 5678))
|
||||
# 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
|
||||
|
||||
4
contrib/.vscode/scripts/WaitForDebugpy.py
vendored
4
contrib/.vscode/scripts/WaitForDebugpy.py
vendored
@@ -13,8 +13,8 @@ def check_socket(host, port):
|
||||
return sock.connect_ex((host, port)) == 0
|
||||
|
||||
def main():
|
||||
# DO NOT CHECK 5678 or debugpy will break
|
||||
# Check other port manually opened instead
|
||||
# DO NOT CHECK the actual port 5678/5879 or debugpy will break
|
||||
# Check that the other port 39999 used as a flag is manually opened instead
|
||||
attempt_counter = 0
|
||||
while (not check_socket('localhost', 39999)) and attempt_counter < MAX_ATTEMPTS:
|
||||
time.sleep(RETRY_DELAY_S)
|
||||
|
||||
Reference in New Issue
Block a user