microsoft / debugpy

An implementation of the Debug Adapter Protocol for Python

Home Page:https://pypi.org/project/debugpy/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Debugger times out if shell startup is "slow"

marcm-ml opened this issue · comments

commented

Environment data

  • debugpy version: v2024.6.0
  • OS and version: macos 14.4.1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.10 CPython
  • Using VS Code or Visual Studio: VS Code

Actual behavior

Debugger never starts and shows "timeout" error window.
In the terminal output you can see that the debugger command has been "pasted"/send to the terminal but the terminal was not ready yet. Hence, the command is discarded.
Its very similar to the issue described here: microsoft/vscode-js-debug#1642

Expected behavior

Debugger waits for terminal to finish and then sends the command to the terminal.

Steps to reproduce:

  1. add a slow command to shell startup, e.g. "sleep 120" to ~/.zshrc or ~/.bashrc
  2. start any debug session with debugpy
  3. debugger will timeout

Background:

I have a zshrc setup that includes some startup scripts which usually take ~0.5-3 seconds. I've never found a satisfying workaround for this and many of the suggested solutions in the Issues in this repo never worked for me.

Current Workaround:

Currently, I am using a setting which works well enough for me
Here is the link to the vscode docs: https://code.visualstudio.com/docs/terminal/profiles#_configuring-the-taskdebug-profile
and here is the setting for me:

{ 
  "terminal.integrated.automationProfile.osx": {
    "path": "bash",
  },
}

However, I wish this extension/debugger would support the same solution as microsoft/vscode-js-debug#1642.