Repository navigation
Fix debugpy.ps1 argument forwarding with splatting (@args) - #1146
Open
TEJA P C (PCTEJA) wants to merge 1 commit into
Open
TEJA P C (PCTEJA) wants to merge 1 commit into
TEJA P C (PCTEJA) wants to merge 1 commit into
Conversation
The PowerShell no-config wrapper forwarded $args without splatting, so an array of arguments passed by a caller reached the Python process concatenated as a single string (e.g. 'arg1 arg2' instead of two separate argv entries). Use @Args in both the Windows (python) and non-Windows (python3) invocations so array arguments expand into separate arguments, matching how the caller could pass them to python directly. Fixes microsoft#1024
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1024.
The PowerShell no-config wrapper
bundled/scripts/noConfigScripts/debugpy.ps1forwarded$argswithout splatting, so when a caller passed an array of arguments, they reached the Python process concatenated as a single string:Change
Use splatting (
@args) in both invocations indebugpy.ps1(Windowspythonbranch and non-Windowspython3branch). Two lines changed; nothing else.Testing
Reproduced and verified with PowerShell 7.4.6 using a stub adapter script that prints
sys.argv:["--listen", "0", "--wait-for-client", "test.py", "arg1 arg2"]["--listen", "0", "--wait-for-client", "test.py", "arg1", "arg2"]"my script.py","one arg") remain single arguments, and invoking with no extra arguments works.The patch was also independently reviewed with Codex (GPT-6 Astra), which re-ran the reproduction across argument-passing modes (42 argv comparisons, all passing) and confirmed splatting semantics for Windows PowerShell 5.1 and PowerShell 7 from Microsoft's documentation. Windows PowerShell 5.1 was not runtime-tested locally (no Windows host available).
This change was prepared with AI assistance (Muse, validated with Codex); I have reviewed every changed line and take responsibility for it.