-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api to retrieve debugpy endpoint and access token? #1529
Comments
There's also a little undocumented hack that we use for tests. If environment variable That aside, yes, I think adding a function to the public API to return this information would be a good idea for scenarios that don't involve explicit listen/connect, and it should be an easy change - Would you be willing to do a PR for it? It should be fairly straightforward, touching these two files: |
Sweet -- thanks for the reply! I just got a free moment to make a PR for this. I wasn't totally clear as to whether the |
I have a program which launches python subprocesses via python's subprocess module using an invocation syntax like:
subprocess.Popen("./path/to/script/with/pyshebangscript", ...])
Where pyshebangscript looks like this and is an auto-generated shim created by poetry from the
[tool.poetry.scripts]
pyproject.toml section.AFAICT this mechanism for invoking the sub process defeats the default
subProcess: true
tracking behavior in debugpy.I found a workaround which appears to work wherein I explicitly reconnect the subprocess back to the original debugging session (here I'm assuming that
os.environ
is exported from parent to child process so that the env variables updated below propogate information to the subprocess).I put this code in my project's root most
__init__.py
fileThe above snippet includes some hacky logic to detect the debugpy endpoint and access_token from the original process's parent process's cli arguments ...
So with that context - I suppose I have a two part question here.
FIrst -- is there a good way to change the
subprocess.Popen
invocation that wouldn't defeat the built in subprocess tracking logic in vscode/debugpy?Second -- if I do need to do something like above to get this working properly, would it be possible to add something to the public api of
debugpy
to make it easy to directly observe the endpoint and access token associated with a connected process? Retrieving these values is needed so that these values can be passed along from the originally debugged process to the subprocess(es) it launches -- where those subprocesses will in turndebugpy.connect()
back to the active debugging session.I think a mechanism to observe these values would be useful even if there's a better way to handle this exact problem, as I believe the logic above would work for subprocesses that get launched on remote hosts as well. I do this on my system as these subprocesses may also execute inside of cloud run jobs ... To get the experience I want (pausing on breakpoints on code executing a cloud run job) -- I think all I will need to figure out is how to get vscode's
debugpy
debugger type to support connections from external network's (rather than binding the debug server port to the default 127.0.0.1 only).The text was updated successfully, but these errors were encountered: