Skip to content

Commit 8216d5e

Browse files
committed
Replace all Write-Host with Write-Output
`Write-Host` is for user interaction.
1 parent 12e82ba commit 8216d5e

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

bin/install_windows_10_sdk.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if ($allowedVersions -notcontains $windows10SDKVersion) {
4545
exit 1
4646
}
4747

48-
Write-Host "Will attempt to set up Windows 10 ($windows10SDKVersion) SDK and Visual Studio Build Tools..."
48+
Write-Output "Will attempt to set up Windows 10 ($windows10SDKVersion) SDK and Visual Studio Build Tools..."
4949

5050
if ($DryRun) {
5151
Write-Output "Running in dry run mode, finishing here."

bin/path_aware_refreshenv.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
# Stop script execution when a non-terminating error occurs
1717
$ErrorActionPreference = "Stop"
1818

19-
Write-Host "PATH before refreshenv is $env:PATH"
19+
Write-Output "PATH before refreshenv is $env:PATH"
2020
$originalPath = "$env:PATH"
21-
Write-Host "Calling refreshenv..."
21+
Write-Output "Calling refreshenv..."
2222
refreshenv
2323
$mergedPath = "$env:PATH;$originalPath" -split ";" | Select-Object -Unique -Skip 1
2424
$env:PATH = ($mergedPath -join ";")
25-
Write-Host "PATH after refreshenv is $env:PATH"
25+
Write-Output "PATH after refreshenv is $env:PATH"

bin/prepare_windows_host_for_app_distribution.ps1

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ param (
2020
# Stop script execution when a non-terminating error occurs
2121
$ErrorActionPreference = "Stop"
2222

23-
Write-Host "--- :windows: Setting up Windows for app distribution"
23+
Write-Output "--- :windows: Setting up Windows for app distribution"
2424

25-
Write-Host "Current working directory: $PWD"
25+
Write-Output "Current working directory: $PWD"
2626

27-
Write-Host "Enable long path behavior"
27+
Write-Output "Enable long path behavior"
2828
# See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation
2929
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
3030

3131
# Disable Windows Defender before starting – otherwise our performance is terrible
32-
Write-Host "Disable Windows Defender..."
32+
Write-Output "Disable Windows Defender..."
3333
$avPreference = @(
3434
@{DisableArchiveScanning = $true}
3535
@{DisableAutoExclusions = $true}
@@ -65,59 +65,59 @@ $avPreference | Foreach-Object {
6565
# https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/microsoft-defender-antivirus-compatibility?view=o365-worldwide
6666
$atpRegPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows Advanced Threat Protection'
6767
if (Test-Path $atpRegPath) {
68-
Write-Host "Set Microsoft Defender Antivirus to passive mode"
68+
Write-Output "Set Microsoft Defender Antivirus to passive mode"
6969
Set-ItemProperty -Path $atpRegPath -Name 'ForceDefenderPassiveMode' -Value '1' -Type 'DWORD'
7070
}
7171

7272
# From https://stackoverflow.com/a/46760714
73-
Write-Host "--- :windows: Setting up Package Manager"
73+
Write-Output "--- :windows: Setting up Package Manager"
7474
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
7575
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
7676

7777
# This should avoid issues with symlinks not being supported in Windows.
7878
#
7979
# See how this build failed
8080
# https://buildkite.com/automattic/beeper-desktop/builds/2895#01919738-7c6e-4b82-8d1d-1c1800481740
81-
Write-Host "--- :windows: :linux: Enable developer mode to use symlinks"
81+
Write-Output "--- :windows: :linux: Enable developer mode to use symlinks"
8282

8383
$developerMode = Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
8484

8585
if ($developerMode.State -eq 'Enabled') {
86-
Write-Host "Developer Mode is already enabled."
86+
Write-Output "Developer Mode is already enabled."
8787
} else {
88-
Write-Host "Enabling Developer Mode..."
88+
Write-Output "Enabling Developer Mode..."
8989
try {
9090
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -NoRestart
9191
} catch {
92-
Write-Host "Failed to enable Developer Mode. Continuing without it..."
92+
Write-Output "Failed to enable Developer Mode. Continuing without it..."
9393
}
9494
}
9595

96-
Write-Host "--- :lock_with_ink_pen: Download Code Signing Certificate"
96+
Write-Output "--- :lock_with_ink_pen: Download Code Signing Certificate"
9797
$certificateBinPath = "certificate.bin"
9898
$EncodedText = aws secretsmanager get-secret-value --secret-id windows-code-signing-certificate `
9999
| jq -r '.SecretString' `
100100
| Out-File $certificateBinPath
101101
$certificatePfxPath = "certificate.pfx"
102102
certutil -decode $certificateBinPath $certificatePfxPath
103-
Write-Host "Code signing certificate downloaded at: $((Get-Item $certificatePfxPath).FullName)"
103+
Write-Output "Code signing certificate downloaded at: $((Get-Item $certificatePfxPath).FullName)"
104104

105-
Write-Host "--- :windows: Checking whether to install Windows 10 SDK..."
105+
Write-Output "--- :windows: Checking whether to install Windows 10 SDK..."
106106

107107
# When using Electron Forge and electron2appx, building Appx requires the Windows 10 SDK
108108
#
109109
# See https://github.com/hermit99/electron-windows-store/tree/v2.1.2?tab=readme-ov-file#usage
110110

111111
if ($SkipWindows10SDKInstallation) {
112-
Write-Host "Run with SkipWindows10SDKInstallation = true. Skipping Windows 10 SDK installation check."
112+
Write-Output "Run with SkipWindows10SDKInstallation = true. Skipping Windows 10 SDK installation check."
113113
exit 0
114114
}
115115

116116
$windowsSDKVersionFile = ".windows-10-sdk-version"
117117
if (Test-Path $windowsSDKVersionFile) {
118-
Write-Host "Found $windowsSDKVersionFile file, installing Windows 10 SDK..."
118+
Write-Output "Found $windowsSDKVersionFile file, installing Windows 10 SDK..."
119119
& "$PSScriptRoot\install_windows_10_sdk.ps1"
120120
If ($LastExitCode -ne 0) { Exit $LastExitCode }
121121
} else {
122-
Write-Host "No $windowsSDKVersionFile file found, skipping Windows 10 SDK installation."
122+
Write-Output "No $windowsSDKVersionFile file found, skipping Windows 10 SDK installation."
123123
}

0 commit comments

Comments
 (0)