fix(codegen): PS5.1-safe quoting for native-exe args in generate-proto probes
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m26s
ci / java (push) Successful in 3m29s
ci / portable (push) Successful in 11m43s

This commit is contained in:
Joseph Doherty
2026-08-18 07:25:42 -04:00
parent 753d070535
commit 8ae0c2f3d3
+5 -1
View File
@@ -36,7 +36,11 @@ function Resolve-Python {
function Assert-GrpcioToolsVersion {
param([string]$Python)
$version = (& $Python -c 'import grpc_tools; from importlib.metadata import version; print(version("grpcio-tools"))').Trim()
# Windows PowerShell 5.1 strips embedded double quotes when passing an argument to a native
# exe (pwsh 7 does not), so a Python literal quoted with " " here would arrive at Python as
# print(version(grpcio-tools)) -> NameError. Use single quotes for the Python string literal
# inside this double-quoted PowerShell string so the quoting survives on both hosts.
$version = (& $Python -c "import grpc_tools; from importlib.metadata import version; print(version('grpcio-tools'))").Trim()
if ($version -ne $PinnedGrpcioToolsVersion) {
throw "grpcio-tools $version is installed, but regeneration is pinned to $PinnedGrpcioToolsVersion. " +
"Install the pin (python -m pip install 'grpcio-tools==$PinnedGrpcioToolsVersion') before regenerating, " +