Commit 78628da9 authored by Robert Iannucci's avatar Robert Iannucci Committed by Commit Bot

[cipd.ps1] catch CommandNotFoundException if git is not available yet

R=brucedawson@chromium.org

Bug: 714920
Change-Id: I6a0ea81e1d87fa2604e9f614a89ff48619cbffd0
Reviewed-on: https://chromium-review.googlesource.com/486085
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: 's avatarVadim Shtayura <vadimsh@chromium.org>
parent 644a1d87
......@@ -28,11 +28,15 @@ if ([environment]::Is64BitOperatingSystem) {
$url = "$cipdClientSrv/client?platform=$plat-$arch&version=$cipdClientVer"
$client = Join-Path $myPath -ChildPath ".cipd_client.exe"
$depot_tools_version = &git -C $myPath rev-parse HEAD 2>&1
if ($LastExitCode -eq 0) {
$user_agent = "depot_tools/$depot_tools_version"
} else {
$user_agent = "depot_tools/???"
try {
$depot_tools_version = &git -C $myPath rev-parse HEAD 2>&1
if ($LastExitCode -eq 0) {
$user_agent = "depot_tools/$depot_tools_version"
} else {
$user_agent = "depot_tools/???"
}
} catch [System.Management.Automation.CommandNotFoundException] {
$user_agent = "depot_tools/no_git/???"
}
$Env:CIPD_HTTP_USER_AGENT_PREFIX = $user_agent
......
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