Skip to content

Commit b405f3c

Browse files
committed
win bug fixes
1 parent e6bbd48 commit b405f3c

File tree

2 files changed

+9
-34
lines changed

2 files changed

+9
-34
lines changed

.github/workflows/test-scripts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ jobs:
328328
path: |
329329
${{ github.workspace }}/bs-logs
330330
C:\Temp\run_test_*.log
331-
C:\Users\runneradmin\run_test_*.log
331+
C:\Users\runneradmin\*.log
332332
retention-days: 30
333333
if-no-files-found: ignore
334334

win/common-utils.ps1

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -65,46 +65,21 @@ function Invoke-GitClone {
6565
if ($Branch) { $args += @("-b", $Branch) }
6666
$args += @($Url, $Target)
6767

68-
$psi = New-Object System.Diagnostics.ProcessStartInfo
69-
$psi.FileName = "git"
70-
$psi.Arguments = ($args -join " ")
71-
$psi.RedirectStandardOutput = $true
72-
$psi.RedirectStandardError = $true
73-
$psi.UseShellExecute = $false
74-
$psi.CreateNoWindow = $true
75-
76-
$p = New-Object System.Diagnostics.Process
77-
$p.StartInfo = $psi
78-
79-
# Collect output asynchronously
80-
$stdout = New-Object System.Text.StringBuilder
81-
$stderr = New-Object System.Text.StringBuilder
82-
83-
$p.add_OutputDataReceived({
84-
if ($_.Data) { $stdout.AppendLine($_.Data) | Out-Null }
85-
})
86-
87-
$p.add_ErrorDataReceived({
88-
if ($_.Data) { $stderr.AppendLine($_.Data) | Out-Null }
89-
})
90-
91-
$p.Start() | Out-Null
92-
$p.BeginOutputReadLine()
93-
$p.BeginErrorReadLine()
68+
# Run git with normal PowerShell invocation
69+
$result = git @args 2>&1
9470

95-
$p.WaitForExit()
96-
97-
# Write logs
71+
# Logging
9872
if ($LogFile) {
99-
if ($stdout.Length -gt 0) { Add-Content $LogFile $stdout.ToString() }
100-
if ($stderr.Length -gt 0) { Add-Content $LogFile $stderr.ToString() }
73+
$result | Out-File -FilePath $LogFile -Append
10174
}
10275

103-
if ($p.ExitCode -ne 0) {
104-
throw "git clone failed (exit $($p.ExitCode)): $($stderr.ToString())"
76+
# Detect failure
77+
if ($LASTEXITCODE -ne 0) {
78+
throw "git clone failed (exit $LASTEXITCODE): $result"
10579
}
10680
}
10781

82+
10883
function Set-ContentNoBom {
10984
param(
11085
[Parameter(Mandatory)][string]$Path,

0 commit comments

Comments
 (0)