diff --git a/scripts/ci_runner_bootstrap.ps1 b/scripts/ci_runner_bootstrap.ps1 index fa469051..bd84d483 100644 --- a/scripts/ci_runner_bootstrap.ps1 +++ b/scripts/ci_runner_bootstrap.ps1 @@ -338,7 +338,8 @@ $runnerDir = '__RUNNER_DIR__' $runnerExe = Join-Path $runnerDir 'gitea-runner.exe' $runnerCfg = Join-Path $runnerDir 'config.yaml' $logDir = Join-Path $runnerDir 'log' -$log = Join-Path $logDir 'runner-stdout.log' +$log = Join-Path $logDir 'runner-watchdog.log' +$daemonLog = Join-Path $logDir 'runner-daemon.log' $probeUrl = '__GITEA_URL__/api/v1/version' $maxWaitSec = 1800 @@ -371,7 +372,15 @@ while ($true) { } Log 'starting daemon' - & $runnerExe daemon --config $runnerCfg *>> $log + # MEASURED TRAP (2026-10-12, hit by this very script): in PowerShell 5.1 the + # *>> redirection is implemented with Out-File, whose DEFAULT ENCODING IS + # UTF-16LE. Appending that into a file whose other lines come from + # Add-Content -Encoding ascii leaves ONE FILE WITH TWO ENCODINGS, and the + # daemon lines read back as "t i m e = 2 0 2 6 ..." (a NUL after every byte). + # Never rely on a redirection's default encoding -- state it explicitly. + # utf8 (not ascii) because job/commit text can legitimately be non-ASCII. + & $runnerExe daemon --config $runnerCfg 2>&1 | + Out-File -FilePath $daemonLog -Append -Encoding utf8 Log ("daemon exited, exit code {0}; restarting in 10s" -f $LASTEXITCODE) Start-Sleep -Seconds 10 } @@ -415,7 +424,8 @@ if ($StartNow) { Warn "Gitea is not answering at $GiteaUrl right now -- the watchdog will keep waiting" } Start-ScheduledTask -TaskName $TaskName - Ok "task started; watch: Get-Content '$(Join-Path $RunnerDir 'log\runner-stdout.log')' -Tail 20" + Ok "task started; daemon log: Get-Content '$(Join-Path $RunnerDir 'log\runner-daemon.log')' -Tail 20" + Ok "watchdog log: Get-Content '$(Join-Path $RunnerDir 'log\runner-watchdog.log')' -Tail 20" Info 'verify on the web UI: repo -> Settings -> Actions -> Runners -> win-stm32-ci should turn Idle' }