X Tutup
Skip to content

fix: Added quotes to unquoted paths in python install and pip upgrade commands#378

Open
franciscogarcia-payroc wants to merge 2 commits intoactions:mainfrom
franciscogarcia-payroc:fix/quote-python-exe-path
Open

fix: Added quotes to unquoted paths in python install and pip upgrade commands#378
franciscogarcia-payroc wants to merge 2 commits intoactions:mainfrom
franciscogarcia-payroc:fix/quote-python-exe-path

Conversation

@franciscogarcia-payroc
Copy link

Added backtick commented out quotes for python install and pip upgrade steps to avoid errors when the hosted tools path has a space in it.

Copilot AI review requested due to automatic review settings March 3, 2026 14:57
@franciscogarcia-payroc franciscogarcia-payroc requested a review from a team as a code owner March 3, 2026 14:57
@franciscogarcia-payroc franciscogarcia-payroc changed the title Fixing issue with space in Quoted paths Fixing issue with space in unquoted paths Mar 3, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Windows Python toolcache setup PowerShell template to better handle hosted tool paths that contain spaces, specifically during pip bootstrapping/upgrade.

Changes:

  • Quote $PythonExePath within the cmd.exe /c invocation for ensurepip and pip install --upgrade to avoid failures when the Python path contains spaces.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@franciscogarcia-payroc franciscogarcia-payroc changed the title Fixing issue with space in unquoted paths fix: Added quotes to unquoted paths in python install and pip upgrade commands Mar 3, 2026
@franciscogarcia-payroc
Copy link
Author

Hello all, simple change that likely affects a lot of consumers. Politely requesting a review from team?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

$ExecParams = Get-ExecParams -IsMSI $IsMSI -IsFreeThreaded $IsFreeThreaded -PythonArchPath $PythonArchPath

cmd.exe /c "cd $PythonArchPath && call $PythonExecName $ExecParams /quiet"
cmd.exe /c "cd `"$PythonArchPath`" && call `"$PythonExecName`" $ExecParams /quiet"
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoting $PythonArchPath and $PythonExecName fixes the cd/call parts, but $ExecParams still embeds $PythonArchPath unquoted (see Get-ExecParams). If $PythonArchPath contains spaces, the expanded command becomes ... TARGETDIR=C:\foo bar\... / DefaultAllUsersTargetDir=C:\foo bar\..., which cmd.exe/the installer will split into multiple arguments and can fail. Consider updating Get-ExecParams to quote the directory values (e.g., TARGETDIR="..." / DefaultAllUsersTargetDir="..."), or avoid cmd.exe and pass an argument array via Start-Process so quoting is handled correctly.

Suggested change
cmd.exe /c "cd `"$PythonArchPath`" && call `"$PythonExecName`" $ExecParams /quiet"
$InstallerPath = Join-Path -Path $PythonArchPath -ChildPath $PythonExecName
& $InstallerPath @ExecParams '/quiet'

Copilot uses AI. Check for mistakes.
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.

2 participants

X Tutup