[?1h=DEBUG:    2+  >>>> & $env:CAPTURE_SCRIPT

DEBUG:   16+  >>>> $ErrorActionPreference = "Stop"

DEBUG:   17+  >>>> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

DEBUG:   19+  >>>> $repo = "pingdotgg/t3code"

DEBUG:   20+  >>>> $baseUrl = if ($env:T3CODE_RELEASE_BASE_URL) { $env:T3CODE_RELEASE_BASE_URL.TrimEnd("/") } else { "http://127.0.0.1:37509/$repo/releases/download" }

DEBUG:   20+ $baseUrl = if ( >>>> $env:T3CODE_RELEASE_BASE_URL) { $env:T3CODE_RELEASE_BASE_URL.TrimEnd("/") } else { "http://127.0.0.1:37509/$repo/releases/download" }

DEBUG:   20+ $baseUrl = if ($env:T3CODE_RELEASE_BASE_URL) {  >>>> $env:T3CODE_RELEASE_BASE_URL.TrimEnd("/") } else { "http://127.0.0.1:37509/$repo/releases/download" }

DEBUG:   21+  >>>> $t3Home = if ($env:T3CODE_HOME) { $env:T3CODE_HOME } else { Join-Path $HOME ".t3" }

DEBUG:   21+ $t3Home = if ( >>>> $env:T3CODE_HOME) { $env:T3CODE_HOME } else { Join-Path $HOME ".t3" }

DEBUG:   21+ $t3Home = if ($env:T3CODE_HOME) {  >>>> $env:T3CODE_HOME } else { Join-Path $HOME ".t3" }

DEBUG:   22+  >>>> $binDir = if ($env:T3CODE_INSTALL_BIN_DIR) { $env:T3CODE_INSTALL_BIN_DIR } else { Join-Path $HOME ".local\bin" }

DEBUG:   22+ $binDir = if ( >>>> $env:T3CODE_INSTALL_BIN_DIR) { $env:T3CODE_INSTALL_BIN_DIR } else { Join-Path $HOME ".local\bin" }

DEBUG:   22+ $binDir = if ($env:T3CODE_INSTALL_BIN_DIR) {  >>>> $env:T3CODE_INSTALL_BIN_DIR } else { Join-Path $HOME ".local\bin" }

DEBUG:   24+  >>>> $binDir = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($binDir)

DEBUG:   31+  >>>> $terminal = -not [Console]::IsErrorRedirected -and $env:TERM -ne "dumb"

DEBUG:   32+  >>>> $interactive = $terminal -and $Host.UI.SupportsVirtualTerminal

DEBUG:   33+ if ( >>>> $interactive) {

DEBUG:   35+    >>>> $glyphs = -join [char[]](0x2588, 0x2580, 0x2584, 0x25A0, 0x00B7)

DEBUG:   36+    >>>> $encoding = [Console]::Error.Encoding

DEBUG:   37+    >>>> $interactive = $encoding.GetString($encoding.GetBytes($glyphs)) -eq $glyphs

DEBUG:   39+  >>>> $esc = [char]27

DEBUG:   40+  >>>> $reset = $bold = $muted = $accent = $green = ""

DEBUG:   40+ $reset =  >>>> $bold = $muted = $accent = $green = ""

DEBUG:   40+ $reset = $bold =  >>>> $muted = $accent = $green = ""

DEBUG:   40+ $reset = $bold = $muted =  >>>> $accent = $green = ""

DEBUG:   40+ $reset = $bold = $muted = $accent =  >>>> $green = ""

DEBUG:   41+ if ( >>>> $interactive -and -not $env:NO_COLOR) {

DEBUG:  102+  >>>> [Console]::Error.WriteLine("CAPTURE_DISPATCH terminal=$terminal interactive=$interactive mechanism=H encoding=$([Console]::Error.Encoding.WebName)")

DEBUG:  102+ [Console]::Error.WriteLine("CAPTURE_DISPATCH terminal=$terminal interactive=$interactive mechanism=H encoding=$( >>>> [Console]::Error.Encoding.WebName)")

CAPTURE_DISPATCH terminal=True interactive=True mechanism=H encoding=utf-8
DEBUG:  104+  >>>> Fetch $env:CAPTURE_URL $env:CAPTURE_DEST -progress

DEBUG:   67+ function Fetch([string] $uri, [string] $destination, [switch] $progress)  >>>> {

DEBUG:   68+   if ( >>>> -not $progress -or -not $interactive) {

DEBUG:   73+    >>>> Add-Type -AssemblyName System.Net.Http

DEBUG:   74+    >>>> $client = New-Object System.Net.Http.HttpClient

DEBUG:   75+    >>>> $response = $source = $file = $null

DEBUG:   75+   $response =  >>>> $source = $file = $null

DEBUG:   75+   $response = $source =  >>>> $file = $null

DEBUG:   77+      >>>> $response = $client.GetAsync($uri, [System.Net.Http.HttpCompletionOption]::ResponseHeadersRead).GetAwaiter().GetResult()

DEBUG:   78+      >>>> $response.EnsureSuccessStatusCode() | Out-Null

DEBUG:   79+      >>>> $source = $response.Content.ReadAsStreamAsync().GetAwaiter().GetResult()

DEBUG:   80+      >>>> $file = [IO.File]::Create($destination)

DEBUG:   81+      >>>> $buffer = New-Object byte[] 65536

DEBUG:   82+      >>>> $bytes = 0L

DEBUG:   83+      >>>> $clock = [Diagnostics.Stopwatch]::StartNew()

DEBUG:   84+      >>>> Draw-Download 0 $response.Content.Headers.ContentLength

DEBUG:   49+ function Draw-Download([long] $bytes, [long] $total)  >>>> {

DEBUG:   50+   if ( >>>> -not $interactive) { return }

DEBUG:   51+    >>>> $columns = [Console]::WindowWidth

DEBUG:   52+   if ( >>>> $columns -le 0) { $columns = 80 }

DEBUG:   53+   if ( >>>> $total -gt 0 -and $columns -ge 9) {

DEBUG:   54+      >>>> $percent = [Math]::Min(100, [Math]::Floor($bytes * 100.0 / $total))

DEBUG:   55+      >>>> $width = [Math]::Min(32, $columns - 8)

DEBUG:   56+      >>>> $filled = [int][Math]::Floor($percent * $width / 100)

DEBUG:   57+      >>>> $bar = ([string][char]0x25A0) * $filled

DEBUG:   58+      >>>> $rest = ([string][char]0x00B7) * ($width - $filled)

DEBUG:   59+      >>>> $sizes = ("  {0:F1} / {1:F1} MB" -f ($bytes / 1MB), ($total / 1MB))

DEBUG:   60+     if ( >>>> $width + 7 + $sizes.Length -ge $columns) { $sizes = "" }

DEBUG:   61+      >>>> [Console]::Error.Write(("`r$esc[2K  $accent$bar$reset$muted$rest$reset {0,3}%" -f $percent) + "$muted$sizes$reset")


[2K  ································   0%  0.0 / 0.3 MBDEBUG:   66+  >>>> }

DEBUG:   85+     while ( >>>> ($count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   85+     while (( >>>> $count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   86+        >>>> $file.Write($buffer, 0, $count)

DEBUG:   87+        >>>> $bytes += $count

DEBUG:   88+       if ( >>>> $clock.ElapsedMilliseconds -ge 100) {

DEBUG:   85+     while ( >>>> ($count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   85+     while (( >>>> $count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   86+        >>>> $file.Write($buffer, 0, $count)

DEBUG:   87+        >>>> $bytes += $count

DEBUG:   88+       if ( >>>> $clock.ElapsedMilliseconds -ge 100) {

DEBUG:   85+     while ( >>>> ($count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   85+     while (( >>>> $count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   86+        >>>> $file.Write($buffer, 0, $count)

DEBUG:   87+        >>>> $bytes += $count

DEBUG:   88+       if ( >>>> $clock.ElapsedMilliseconds -ge 100) {

DEBUG:   85+     while ( >>>> ($count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   85+     while (( >>>> $count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   86+        >>>> $file.Write($buffer, 0, $count)

DEBUG:   87+        >>>> $bytes += $count

DEBUG:   88+       if ( >>>> $clock.ElapsedMilliseconds -ge 100) {

DEBUG:   85+     while ( >>>> ($count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   85+     while (( >>>> $count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) {

DEBUG:   96+     if ( >>>> $file) { $file.Dispose() }

DEBUG:   96+     if ($file) {  >>>> $file.Dispose() }

DEBUG:   97+     if ( >>>> $source) { $source.Dispose() }

DEBUG:   97+     if ($source) {  >>>> $source.Dispose() }

DEBUG:   98+     if ( >>>> $response) { $response.Dispose() }

DEBUG:   98+     if ($response) {  >>>> $response.Dispose() }

DEBUG:   99+      >>>> $client.Dispose()

DEBUG:  109+    >>>> [Console]::Error.WriteLine("EXCEPTION_TYPE=$($_.Exception.GetType().FullName)")

DEBUG:  109+   [Console]::Error.WriteLine("EXCEPTION_TYPE=$( >>>> $_.Exception.GetType().FullName)")

EXCEPTION_TYPE=System.Management.Automation.MethodInvocationException
DEBUG:  110+    >>>> [Console]::Error.WriteLine("ORIGINAL_STATUS=$([int]$_.Exception.Response.StatusCode)")

DEBUG:  110+   [Console]::Error.WriteLine("ORIGINAL_STATUS=$( >>>> [int]$_.Exception.Response.StatusCode)")

ORIGINAL_STATUS=0
DEBUG:  111+    >>>> [Console]::Error.WriteLine("STATUS_VALUE=$($_.Exception.Response.StatusCode.value__)")

DEBUG:  111+   [Console]::Error.WriteLine("STATUS_VALUE=$( >>>> $_.Exception.Response.StatusCode.value__)")

STATUS_VALUE=
DEBUG:  112+    >>>> [Console]::Error.WriteLine("EXCEPTION=$($_.Exception.Message)")

DEBUG:  112+   [Console]::Error.WriteLine("EXCEPTION=$( >>>> $_.Exception.Message)")

EXCEPTION=Exception calling "Read" with "3" argument(s): "The response ended prematurely, with at least 131420 additional bytes expected. (ResponseEnded)"
DEBUG:  113+    >>>> throw

DEBUG:  114+ } finally {  >>>> [Console]::Error.WriteLine("CAPTURE_CALLER_FINALLY") }

CAPTURE_CALLER_FINALLY
ParentContainsErrorRecordException: /tmp/lead-32913-r1/evidence-capture/runs-20261110T104757.726561Z/P17-httpclient-truncated-H/before/install.ps1:85
Line |
  85 |      while (($count = $source.Read($buffer, 0, $buffer.Length)) -gt 0) …
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "Read" with "3" argument(s): "The response ended prematurely, with at least 131420 additional
     | bytes expected. (ResponseEnded)"
