From 7b56ac47e662d4870bf0b4501b202e3dbc007df9 Mon Sep 17 00:00:00 2001 From: equinoxtian Date: Wed, 17 Dec 2025 11:03:54 -0800 Subject: [PATCH] Fix .cipd_impl.ps1 failure because of execution policy The introduction of the `-File` parameter for invoking .cipd_impl.ps1 made its execution dependent on the system's PowerShell ExecutionPolicy, causing failures in restricted environments. This CL solves following problems: 1. Failures when the depot_tools path contains whitespace. 2. Make cipd.bat behave consistently with how it did before introducing '-File' Bug: 428834916 Change-Id: Idf16bfeb5d5188dc4a13ab3200f692d99b3d33af Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7257554 Reviewed-by: Gavin Mak Reviewed-by: Sam Lewis Commit-Queue: Sam Lewis --- cipd.bat | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cipd.bat b/cipd.bat index c16b63a0f4..0a1be12fe1 100644 --- a/cipd.bat +++ b/cipd.bat @@ -10,6 +10,7 @@ set VERSION_FILE=%~dp0cipd_client_version set CIPD_BINARY=%~dp0.cipd_client.exe set CIPD_PLATFORM=windows-amd64 set PLATFORM_OVERRIDE_FILE=%~dp0.cipd_client_platform +set CIPD_IMPL=%~dp0.cipd_impl.ps1 :: Uncomment to recognize arm64 by default. :: if %PROCESSOR_ARCHITECTURE%==ARM64 ( @@ -75,13 +76,13 @@ exit /b %EXPORT_ERRORLEVEL% :: and unzipping the depot_tools.zip distribution, we clear the Zone.Identifier :: alternate data stream. This is equivalent to clicking the "Unblock" button :: in the file's properties dialog. -echo.>"%~dp0.cipd_impl.ps1:Zone.Identifier" +echo.>"%CIPD_IMPL%:Zone.Identifier" powershell -NoProfile -ExecutionPolicy RemoteSigned ^ - -File "%~dp0.cipd_impl.ps1" ^ - -CipdBinary "%CIPD_BINARY%" ^ - -Platform "%CIPD_PLATFORM%" ^ - -BackendURL "%CIPD_BACKEND%" ^ - -VersionFile "%VERSION_FILE%" ^ + -Command "& \"%CIPD_IMPL%\"" ^ + "-CipdBinary \"%CIPD_BINARY%\"" ^ + "-Platform \"%CIPD_PLATFORM%\"" ^ + "-BackendURL \"%CIPD_BACKEND%\"" ^ + "-VersionFile \"%VERSION_FILE%\"" ^