8000 Fix 'using module' when module has non-terminating errors handled with 'SilentlyContinue' by daxian-dbw · Pull Request #4711 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Fix 'using module' when module has non-terminating errors handled with 'SilentlyContinue' #4711

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

Merged
merged 1 commit into from
Sep 1, 2017

Conversation

daxian-dbw
Copy link
Member

Attempt to fix #4695

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.

@daxian-dbw daxian-dbw requested review from lzybkr and powercode August 30, 2017 23:23
@daxian-dbw daxian-dbw removed the request for review from vors August 30, 2017 23:24
@daxian-dbw daxian-dbw self-assigned this Aug 30, 2017
@daxian-dbw daxian-dbw requested a review from vors August 30, 2017 23:29
Copy link
Member
@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator
@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave a comment

Copy link
Collaborator
@powercode powercode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daxian-dbw daxian-dbw merged commit 795de73 into PowerShell:master Sep 1, 2017
@daxian-dbw daxian-dbw deleted the loadmodule branch September 1, 2017 15:54
@daxian-dbw
Copy link
Member Author

Thanks all for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArgumentOutOfRangeException in Compiler.LoadModule
6 participants
0