Skip to content

Commit bbb4620

Browse files
committed
fix(tools): print each startup log line once in ninfer-switch
While a server loads, the progress poll repeated the same last log line every few seconds. It now prints a line only when it changes.
1 parent 16eaf07 commit bbb4620

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎tools/windows/ninfer-switch.ps1‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,13 @@ function Start-Server([string]$name, $cfg) {
9696
[ordered]@{ profile = $name; pid = $proc.Id; started = (Get-Date).ToString('o'); port = $cfg.port } |
9797
ConvertTo-Json | Set-Content -LiteralPath $StateFile -Encoding utf8
9898
Write-Host "starting $name ($($p.note))"
99+
$shown = $null
99100
for ($i = 0; $i -lt 300; $i++) {
100101
if (Test-Ready $cfg) { Write-Host "serving $name on http://127.0.0.1:$($cfg.port)/v1"; return }
101102
if ($proc.HasExited) { break }
102103
if ($i % 5 -eq 4 -and (Test-Path -LiteralPath $Log)) {
103104
$last = Get-Content -LiteralPath $Log -Tail 1
104-
if ($last) { Write-Host (' ' + $last.Substring(0, [math]::Min(110, $last.Length))) }
105+
if ($last -and $last -ne $shown) { Write-Host (' ' + $last.Substring(0, [math]::Min(110, $last.Length))); $shown = $last }
105106
}
106107
Start-Sleep 1
107108
}

0 commit comments

Comments
 (0)