Skip to content

Prepend noConfigScripts directory to PATH so bundled debugpy wrapper wins - #1148

Open
TEJA P C (PCTEJA) wants to merge 1 commit into
microsoft:mainfrom
PCTEJA:prepend-noconfig-scripts-path-931
Open

TEJA P C (PCTEJA) wants to merge 1 commit into
microsoft:mainfrom
PCTEJA:prepend-noconfig-scripts-path-931

Conversation

@PCTEJA

Copy link
Copy Markdown

Summary

Fixes #931.

Since debugpy 1.8.5, the debugpy Python package installs its own debugpy command. The extension appended the noConfigScripts directory (which holds the bundled debugpy wrapper) to the end of the integrated terminal's PATH, so a user-installed debugpy package shadows the bundled wrapper and debugpy script.py in the terminal runs the wrong command.

Change

In registerNoConfigDebug (src/extension/noConfigDebugInit.ts), prepend the directory instead of appending it:

collection.prepend('PATH', `${noConfigScriptsDir}${pathSeparator}`);

VS Code's prepend implementation concatenates value + existingValue and adds no separator itself, so the value carries the trailing separator (; on Windows, : elsewhere) — the mirror of the previous leading-separator fix for the concatenation regression (#843/#1011), which this preserves.

The two unit tests that asserted the append behaviour now assert prepend with the value ${noConfigScriptsDir}${pathSeparator}.

Testing

  • npm run compile-tests (tsc) passes; eslint and prettier --check pass on both changed files.
  • The patch was independently reviewed with Codex (GPT-6 Astra), which confirmed the prepend semantics against VS Code's own environmentVariableCollection implementation, verified the changed logic across Windows/POSIX and populated/empty/unset PATH combinations, and confirmed no other code in the repo adds this directory to PATH.
  • The full VS Code test-host suite was not run locally (it requires downloading a VS Code build); CI will exercise it. The scope of the PATH change is narrow: the directory contains only the four debugpy wrapper scripts, so no unrelated command is shadowed.

This change was prepared with AI assistance (Muse, validated with Codex); I have reviewed every changed line and take responsibility for it.

…wins

Since debugpy 1.8.5, the debugpy Python package installs its own
debugpy command. The extension appended the noConfigScripts directory
to the end of the integrated terminal PATH, so a user-installed
debugpy package shadowed the bundled wrapper and 'debugpy script.py'
ran the wrong command.

Prepend the directory (with its trailing separator) instead, and
update the unit tests that asserted the append behaviour.

Fixes microsoft#931
@PCTEJA

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect debugpy command selected in terminal

1 participant