Use correct isError parameter with Write-Log when logging an error#11592
Use correct isError parameter with Write-Log when logging an error#11592JamesWTruher wants to merge 278 commits intoPowerShell:masterfrom
Conversation
build.psm1
Outdated
There was a problem hiding this comment.
@JamesWTruher Could you please elaborate a bit why -message needs to be specified?
It is a positional parameter (position = 0), so it looks to me should have worked as expected.
PS:4> gcm Write-Log | % Definition
param
(
[Parameter(Position=0, Mandatory)]
[ValidateNotNullOrEmpty()]
[string] $message,
[switch] $isError
)
if ($isError)
{
Write-Host -Foreground Red $message
}
else
{
Write-Host -Foreground Green $message
}
#reset colors for older package to at return to default after error message on a compilation error
[console]::ResetColor()There was a problem hiding this comment.
Generally, positional parameters are less preferred than being explicit (we have an analyzer rule for this). While I was making the changes elsewhere to the use of Write-Log, I thought I should do it here.
|
@JamesWTruher Please resolve conflicts |
0fff5f5 to
2c21771
Compare
| @@ -314,7 +314,7 @@ function Start-PSBuild { | |||
| } | |||
There was a problem hiding this comment.
@JamesWTruher, your last commit had 1 failures in PowerShell-CI-windows
Remove-Item UnAuthorized Access.Access-denied test for removing a folder
Expected exactly 'RemoveItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand', but got $null.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\Microsoft.PowerShell.Management\FileSystem.Tests.ps1: line 1424
1424: Get-Content $errorFile | Should -BeExactly 'RemoveItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand'* Autofix `RCS1036: Remove redundant empty line` * Autofix `RCS1037: Remove trailing white-space` * Autofix `RCS1033: Remove redundant boolean literal` * Autofix: `RCS1038: Remove empty statement` * Autofix `RCS1041: Remove empty initializer` * Autofix `RCS1097: Remove redundant 'ToString' call * Autofix: `RCS1420: Operator is unnecessary`
|
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment. |
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Dongbo Wang <[email protected]>
…12972) Co-authored-by: Aditya Patwardhan <Aditya Patwardhan>
|
Merged #12989 |
|
This was not rebased correctly. |
PR Summary
It looks like the wrong parameter was being used with
Write-Logcausing difficulties when logging errors.PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.