[Python] VS Code: how to get process ID via shell command in launch.json?

Discussão em 'Python' iniciado por Stack, Agosto 22, 2025.

  1. Stack

    Stack Membro Participativo

    In our Visual Studio Code configuraiton launch.json looks like this:

    {
    "version": "0.2.0",
    "configurations": [
    {
    "type": "fb-python",
    "request": "attach",
    "name": "Attach to a running Python process",
    "processId": "${command:pickProcess}",
    "subProcess": true,
    "justMyCode": true,
    "redirectOutput": true,
    "django": true,
    "client": "instagram"
    }
    ]
    }


    It shows process selection dialog every time I click "Debug". What I want to do is to calculate the process ID using a shell command:

    ps -ef | grep "async uWSGI worker 1" | grep -v grep | awk '{print $2}'


    How can I do that without writing a custom extension?

    Continue reading...

Compartilhe esta Página