You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Write-Host ForegroundColor error on Linux: "-1 is not a valid color" #372
When running the PowerShell script on Linux using PowerShell (pwsh), the script throws the following error:
Write-Host: Cannot process the color because -1 is not a valid color. (Parameter 'value')
This happens because the script uses:
as the default value for -ForegroundColor in Write-Host.
In some Linux or non-interactive environments (for example CI/CD pipelines), System.Console::ForegroundColor returns -1, which is not a valid ConsoleColor value.
As a result, Write-Host fails when the script tries to use this value.
Can we add a condition to enforce a color in case ForegroundColor is not set.
Activity