Fix command runtime so StopUpstreamCommandsException doesn't get populated in -ErrorVariable#10840
Conversation
test/powershell/Modules/Microsoft.PowerShell.Utility/Select-Object.Tests.ps1
Outdated
Show resolved
Hide resolved
|
@SteveL-MSFT Why do you start to add prefixes to PR titles? This is contrary to our conventions. |
…ject.Tests.ps1 Co-Authored-By: Ilya <[email protected]>
|
@iSazonov trying something based on an article I read about good commit messages. I suppose the prefix can be just in the commit and not in the PR title. |
-ErrorVariable-ErrorVariable
|
@SteveL-MSFT All that we can not formalize is a human factor. I mean, something that can make things clearer can also be misleading. In this case, the simpler the better. So better not to have prefixes at all. |
|
@SteveL-MSFT https://gitmoji.carloscuesta.me/ But regardless, I agree that for commit messages having an easily-identifiable prefix can be a nice-to-have. Whether that's emoji or text is, I suppose, up to you guys. 😄
|
|
🎉 Handy links: |
PR Summary
StopUpstreamCommandsExceptionis a special exception used by cmdlets to tell PowerShell to stop upstream commands as it doesn't need any additional input. For example: "1,2,3 | select-object -first 1" should stop the first part of the pipeline afterselect-objectreceived 1 object as the request has been fulfilled. However, if you use1,2,3 | select-object -first 1 -errorvariable err, the internal exception (which is handled) is put into the$errvariable (although$errorit not populated). This means that scripts may treat this as an error or special case thisSystem errorand throwing it away.The fix is in the code where the engine populates
-ErrorVariableto discardStopUpstreamCommandsException.I don't believe this is a breaking change as anyone working around this by throwing away that specific error (because
select-objectactually succeeded) won't be impacted by this change.PR Context
Fix #9185
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.