Skip to content

Commit 5a46259

Browse files
committed
Fixup PS5.1 Help Script
1 parent 1cca650 commit 5a46259

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

PowerShellEditorServices.build.ps1

+4-6
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Task SetupHelpForTests {
202202

203203
$installHelpScript = {
204204
param(
205-
[Parameter(Mandatory)][string]$helpPath
205+
[Parameter(Position = 0)][string]$helpPath
206206
)
207207
$PSVersion = $PSVersionTable.PSVersion
208208
$ErrorActionPreference = 'Stop'
@@ -242,7 +242,6 @@ Task SetupHelpForTests {
242242
$updateHelpParams.'Scope' = 'CurrentUser'
243243
}
244244
#Update the help, and capture verbose output
245-
Wait-Debugger
246245
$updateHelpOutput = Update-Help @updateHelpParams *>&1
247246

248247
if ((Get-Help Invoke-RestMethod).remarks -like 'Get-Help cannot find the Help files*') {
@@ -255,27 +254,26 @@ Task SetupHelpForTests {
255254
#Need this to inject the help file path, since PSScriptRoot won't work inside the script
256255
$helpPath = Resolve-Path "$PSScriptRoot\test\PowerShellEditorServices.Test.Shared\PSHelp" -ErrorAction Stop
257256
Write-Host -Fore Magenta "Runner Help located at $helpPath"
258-
$resolvedScript = $installHelpScript -replace '{{HELPPATH}}', $helpPath
259257

260258
if (Get-Command powershell.exe -CommandType Application -ea 0) {
261259
Write-Host -Fore Magenta 'Checking PowerShell 5.1 help'
262-
powershell.exe -NoProfile -NonInteractive -Command $resolvedScript -args $helpPath
260+
& powershell.exe -NoProfile -NonInteractive -Command $installHelpScript -args $helpPath
263261
if ($LASTEXITCODE -ne 0) {
264262
throw 'Failed to install PowerShell 5.1 Help.'
265263
}
266264
}
267265

268266
if ($PwshDaily -and (Get-Command $PwshDaily -ea 0)) {
269267
Write-Host -Fore Magenta "Checking PWSH Daily help at $PwshDaily"
270-
& $PwshDaily -NoProfile -NonInteractive -Command $resolvedScript -args $helpPath
268+
Invoke-BuildExec { & $PwshDaily -NoProfile -NonInteractive -Command $installHelpScript -args $helpPath }
271269
if ($LASTEXITCODE -ne 0) {
272270
throw 'Failed to install PowerShell Daily Help.'
273271
}
274272
}
275273

276274
if ($PSEdition -eq 'Core') {
277275
Write-Host -Fore Magenta 'Checking Runner Pwsh help'
278-
& ([ScriptBlock]::Create($resolvedScript)) $helpPath
276+
& $installHelpScript $helpPath
279277
}
280278
}
281279

0 commit comments

Comments
 (0)