New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore PassThru when run fail while using Run.Exit #2303
Conversation
ResultObject was printed as text due to bein sent to standard output, but never reached variable assignment because Run.Exit kills the process
# - setting the exit code when there were some failed tests, blocks, or containers | ||
$failedCount = $run.FailedCount + $run.FailedBlocksCount + $run.FailedContainersCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assigning this twice in case we don't reach the previous one inside try/catch
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This will break But is this intended to work or just luck? I'd lean towards merging this, because |
Exit in powershell is defined as exiting the script with the error code, not the engine. So $res = & ./test.ps1 should imho assign the value, rather than not. Or am I misinterpreting what you are saying here? |
I think we agree. There's two sides here and I'm not sure if fixing one is worth breaking the other, which is why I left this without ready to merge. The question is if anyone's gonna be missing the part being broken. Current behavior: Catching output from script Calling Pester directly |
Close or keep? I agree with your reasoning above that neither case is preferable, so maybe just keep the current one and close this? |
I'd say merge in v6. Easy rollback if necessary. I'm struggling to see when someone would combine Run.Exit with processing script output. If so they could just drop Run.Exit and add a check in their script to get the previous behavior. |
PR Summary
Result object was printed when run failed because it was sent to standard output, but never reached variable assignment before
Run.Exit
killed the process causing a text dump.Fix #2300
PR Checklist
Create Pull Request
to mark it as a draft. PR can be markedReady for review
when it's ready.