Commit 7466d1a9 authored by Dan Jacques's avatar Dan Jacques Committed by Commit Bot

[cipd] Run client in .bat to preserve STDIN.

Currently, the PowerShell execution does not allow STDIN to be
read by the CIPD client. Fix this by using PowerShell to acquire
the client, but batch to actually invoke the client. This removes
some indirection and allows STDIN to function as expected.

BUG=None
TEST=local
  - Ran w/ and w/out ".cipd_client.exe" locally, observed
    install and fallthrough.
  - Ran w/ an error code, observed exit code being preserved.
  - Ran "auth-login", was able to paste token.

Change-Id: I4efafa7dc80aa093de0fbf5dfd188c299fa104db
Reviewed-on: https://chromium-review.googlesource.com/563602
Commit-Queue: Daniel Jacques <dnj@chromium.org>
Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
parent 13f258bf
...@@ -3,10 +3,28 @@ ...@@ -3,10 +3,28 @@
:: Use of this source code is governed by a BSD-style license that can be :: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file. :: found in the LICENSE file.
setlocal
:: To allow this powershell script to run if it was a byproduct of downloading :: To allow this powershell script to run if it was a byproduct of downloading
:: and unzipping the depot_tools.zip distribution, we clear the Zone.Identifier :: and unzipping the depot_tools.zip distribution, we clear the Zone.Identifier
:: alternate data stream. This is equivalent to clicking the "Unblock" button :: alternate data stream. This is equivalent to clicking the "Unblock" button
:: in the file's properties dialog. :: in the file's properties dialog.
echo.>"%~dp0\cipd.ps1:Zone.Identifier" set errorlevel=
if not exist "%~dp0.cipd_client.exe" (
echo.>%~dp0cipd.ps1:Zone.Identifier
powershell -NoProfile -ExecutionPolicy RemoteSigned -Command "%~dp0cipd.ps1" < nul
if not errorlevel 0 goto :END
)
set /p CIPD_CLIENT_VER=<%~dp0cipd_client_version
"%~dp0.cipd_client.exe" selfupdate -version "%CIPD_CLIENT_VER%"
if not errorlevel 0 goto :END
"%~dp0.cipd_client.exe" %*
powershell -NoProfile -ExecutionPolicy RemoteSigned -Command "%~dp0\cipd.ps1" %* < nul :END
endlocal & (
set ERRORLEVEL=%ERRORLEVEL%
)
exit /b %ERRORLEVEL%
...@@ -68,13 +68,4 @@ while ($true) { ...@@ -68,13 +68,4 @@ while ($true) {
$cipd_lock_file.close() $cipd_lock_file.close()
} }
} }
} }
\ No newline at end of file
$_ = & $client selfupdate -version "$cipdClientVer"
if ($LastExitCode -ne 0) {
Write-Host "selfupdate failed: " -ForegroundColor Red -NoNewline
Write-Host "run ``set CIPD_HTTP_USER_AGENT_PREFIX=$user_agent/manual && $client selfupdate -version $cipdClientVer`` to diagnose`n" -ForegroundColor White
}
& $client @args
exit $LastExitCode
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment