fix(bench): named Set-Content params — positional+NoNewline silently wrote nothing on PS 5.1

This commit is contained in:
iamdoubz committed 2026-07-15 21:45:46 -05:00
1 parent 297c412488
commit 68632db6ef
1 file changed
+4 -1
+4 -1
View File
@@ -39,6 +39,9 @@ foreach ($f in $flacs) {
$trans = Get-ChildItem -Path $f.DirectoryName -Filter *.trans.txt | Select-Object -First 1
$line = Get-Content $trans.FullName | Where-Object { $_.StartsWith("$name ") } | Select-Object -First 1
if (-not $line) { throw "no reference line for $name" }
Set-Content -Encoding utf8 -NoNewline (Join-Path $corpus "$name.txt") $line.Substring($name.Length + 1)
# Named parameters on purpose: positional binding alongside -NoNewline
# silently wrote nothing under Windows PowerShell 5.1 (found the hard way);
# the WER normalizer doesn't care about a trailing newline.
Set-Content -Path (Join-Path $corpus "$name.txt") -Value $line.Substring($name.Length + 1) -Encoding utf8
}
Write-Output "staged $($flacs.Count) utterances in $corpus"