Skip to content

Commit e25473d

Browse files
authored
Setting strict mode and error action preference to stop on remaining PS scripts (#5950)
* Setting strict mode and error action preference to stop on remaining powershell scripts * Fixing install VCLibs script
1 parent cf3c710 commit e25473d

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

build/InstallVCLibs.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ param(
22
[Parameter(Mandatory = $true)]
33
[ValidateSet("x86", "x64", "arm64")]
44
[string]$Platform,
5-
5+
66
# Expecting BuildOutput\Release
77
[Parameter(Mandatory = $true)]
88
[string]$SourceDirectory
99
)
1010

11+
Set-StrictMode -Version 3.0
1112
$ErrorActionPreference = "Stop"
1213

1314
Write-Host "Installing VCLibs packages for platform: $Platform" -ForegroundColor Green
@@ -34,22 +35,21 @@ $InstalledPackages = @{}
3435

3536
foreach ($Package in $VCLibsPackages) {
3637
$PackageName = $Package.Name
37-
38+
3839
if ($InstalledPackages.ContainsKey($PackageName)) {
3940
continue
4041
}
41-
42+
4243
try {
4344
Write-Host "Installing: $PackageName" -ForegroundColor White
4445
Add-AppxPackage -Path $Package.FullName -ForceApplicationShutdown
45-
46+
4647
$InstalledPackages[$PackageName] = $Package.FullName
47-
$TotalInstalled++
4848
Write-Host " -> Success" -ForegroundColor Green
4949
}
5050
catch {
5151
Write-Error "Failed to install $PackageName`: $($_.Exception.Message)"
5252
}
5353
}
5454

55-
Write-Host "Completed successfully!" -ForegroundColor Green
55+
Write-Host "Completed successfully!" -ForegroundColor Green

build/scripts/CopyContents.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ param (
66
[string]$TargetDir = ''
77
)
88

9+
Set-StrictMode -Version 3.0
10+
$ErrorActionPreference = 'Stop'
11+
912
foreach ($Contents in $ContentsList)
1013
{
1114
$ContentsPath = (Join-Path $SourceDir $Contents)

build/scripts/RobocopyWrapper.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ param (
33
[string]$dest = "",
44
[string]$options = "/E /XC /XN /XO /NJH /NJS /NDL /NP /NFL"
55
)
6+
7+
Set-StrictMode -Version 3.0
8+
$ErrorActionPreference = 'Stop'
9+
610
$robocopyCmd = "robocopy $source $dest $options"
711

812
Invoke-Expression $robocopyCmd

tools/TerminalVelocity/Generate-TerminalVelocityFeatures.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Param(
4747
)
4848

4949
Set-StrictMode -Version 3.0
50+
$ErrorActionPreference = 'Stop'
5051

5152
# Make sure Channel has the exact spelling even if the parameter had different case
5253
foreach ($c in "Experimental", "Preview", "Stable", "WindowsInbox")

0 commit comments

Comments
 (0)