Skip to content
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

tasks.json watcher launched by debugger never flags as a ready background task #129121

Closed
tigerhawkvok opened this issue Jul 21, 2021 · 2 comments
Labels
*caused-by-extension Issue identified to be caused by an extension

Comments

@tigerhawkvok
Copy link

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version:
    Version: 1.58.2 (user setup)
    Commit: c3f1263
    Date: 2021-07-14T22:10:15.214Z
    Electron: 12.0.13
    Chrome: 89.0.4389.128
    Node.js: 14.16.0
    V8: 8.9.255.25-electron.0
    OS: Windows_NT x64 10.0.19043
  • OS Version: Windows 10 19403.1110

Steps to Reproduce:

  1. Have a prerequisite prelaunch task for the debugger to run that must be in the background during the debug session
  2. Run the debugger

I'm trying to run my debug environment as a Poetry session, so I can properly debug encapsulated.

So, my launch.json is straightforward:

        {
            "name": "Poetry",
            "type": "python",
            "request": "attach",
            "connect": {
                "host": "localhost",
                "port": 5710
            },
            "preLaunchTask": "poetryDebugSession"
        }

and I adapted my tasks.json to try to launch debugpy in Poetry first (this works if I manually run the command in the terminal then run the launch.json without the preLaunchTask)

{
            "label": "poetryDebugSession",
            "type": "shell",
            "command": "poetry",
            "args": [
                "run",
                "python",
                "-m",
                "debugpy",
                "--log-to-stderr",
                "--wait-for-client",
                "--listen",
                "5710",
                "${relativeFile}"
            ],
            "presentation": {
                "panel": "dedicated",
                "clear": true
            },
            "group": "test",
            "isBackground": true, // probably redundant now
            "runOptions":{
                "instanceLimit": 1
            },
            // This task is run before the launch.json task. Since it needs to run in the
            // background and not wait for completion, though, we need to jump through hoops
            "problemMatcher": [
                {
                    "owner": "python",
                    "fileLocation": "absolute",
                    "pattern": [
                        {
                            "regexp": "^\\s+File \"(.*)\", line (\\d+), in (.*)$",
                            "file": 1,
                            "line": 2
                        },
                        {
                            "regexp": "^\\s+(.*)$",
                            "message": 1
                        }
                    ],
                    "background": {
                        "activeOnStart": true,
                        "beginsPattern": "^D[0-9\\.: \\+]+wait_for_client",
                        "endsPattern": ".*",
                    }
                }
            ]
        }

When I start debugging, the task is properly launched, and debugpy gets all the way to the message I am waiting for that I want the preluanch task to be marked as "ready":

> Executing task: poetry run python -m debugpy --log-to-stderr --wait-for-client --listen 5710 d:\path\to\myfile.py <
# stuff

I+00000.344: pydevd is connected to adapter at 127.0.0.1:61443

D+00000.344: wait_for_client()

I could have sworn I had this working last week but as of 1.58.2 after a restart this morning it doesn't progress past wait_for_client() display, so the debugger never attaches. I'm also a little suspicious that ${relativeFile} includes a full path in my output but that probably doesn't matter.

@weinand
Copy link
Contributor

weinand commented Jul 21, 2021

/extPython

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*caused-by-extension Issue identified to be caused by an extension
Projects
None yet
Development

No branches or pull requests

3 participants
@tigerhawkvok @weinand and others