Repository navigation
Fix 'using module' when module has non-terminating errors handled with 'SilentlyContinue' - #4711
Merged
Conversation
…h 'SilentlyContinue'
Dongbo Wang (daxian-dbw)
requested review from
Jason Shirk (lzybkr) and
Staffan Gustafsson (powercode)
August 30, 2017 23:23
Dongbo Wang (daxian-dbw)
requested review from
Bruce Payette (BrucePay) and
sergei (vors)
as code owners
August 30, 2017 23:23
Ilya (iSazonov)
approved these changes
Aug 31, 2017
Ilya (iSazonov)
left a comment
Collaborator
There was a problem hiding this comment.
Leave a comment
sergei (vors)
approved these changes
Sep 1, 2017
Staffan Gustafsson (powercode)
approved these changes
Sep 1, 2017
Staffan Gustafsson (powercode)
left a comment
Collaborator
There was a problem hiding this comment.
LGTM
Member
Author
|
Thanks all for the review! |
Thatgfsj (Thatgfsj)
pushed a commit
to Thatgfsj-contribs/PowerShell
that referenced
this pull request
Aug 6, 2026
…h 'SilentlyContinue' (PowerShell#4711) `Compiler.LoadModule` assumes that when `ps.HadErrors == true` the error stream is not empty. However, when `SilentlyContinue` is specified as the error action, the non-terminating error is not kept in `ErrorOutputPipe` of the cmdlet and thus does not appear in `ps.Streams.Error`. So when `ps.HadErrors == true` while `ps.Streams.Error` is empty, it suggests it's OK to ignore the errors because they are explicitly suppressed with `SilentlyContinue` error action. So in my opinion, the expected behavior of `"using module .\mod.psm1"` in this case should be successful as if `ps.HaddErrors` is false.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Attempt to fix #4695
Compiler.LoadModuleassumes that whenps.HadErrors == truethe error stream is not empty. However, whenSilentlyContinueis specified as the error action, the non-terminating error is not kept inErrorOutputPipeof the cmdlet and thus does not appear inps.Streams.Error. So whenps.HadErrors == truewhileps.Streams.Erroris empty, it suggests it's OK to ignore the errors because they are explicitly suppressed withSilentlyContinueerror action.So in my opinion, the expected behavior of
"using module .\mod.psm1"in this case should be successful, as ifps.HaddErrorsis false.