Skip to content

Fix $? to not be $false because native command wrote to stderr - #13395

Merged
Dongbo Wang (daxian-dbw) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:native-dollarhook
Aug 19, 2020
Merged

Dongbo Wang (daxian-dbw) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:native-dollarhook

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Aug 10, 2020 •

Copy link
Copy Markdown
Member

PR Summary

As @PowerShell/powershell-committee had agreed that a native command writing to stderr is not an indicator of failure, it doesn't make sense to have $? to $false unless the native command also has a non-zero exit code. Fix is to move the setting of pipeline failure to the block only if the error record is not from a native command.

This is an addition to Experimental Feature PSNotApplyErrorActionToStderr.

PR Context

Fix #13393

PR Checklist

@SteveL-MSFT Steve Lee (SteveL-MSFT) added the CL-BreakingChange Indicates that a PR should be marked as a breaking change in the Change Log label Aug 10, 2020
@iSazonov Ilya (iSazonov) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Aug 11, 2020
@TravisEz13 Travis Plunk (TravisEz13) added CL-Engine Indicates that a PR should be marked as an engine change in the Change Log and removed CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log labels Aug 11, 2020
@TravisEz13

Copy link
Copy Markdown
Member

PoshChan-Bot (@PoshChan) Please remind me in 12 hours

@PoshChan

Copy link
Copy Markdown
Collaborator

Travis Plunk (@TravisEz13), this is the reminder you requested 12 hours ago

@ghost ghost added the Review - Needed The PR is being reviewed label Aug 19, 2020
@ghost

Copy link
Copy Markdown

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit d67649c into PowerShell:master Aug 19, 2020
@ghost ghost removed the Review - Needed The PR is being reviewed label Aug 19, 2020
@ghost

Copy link
Copy Markdown

🎉v7.1.0-preview.7 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-BreakingChange Indicates that a PR should be marked as a breaking change in the Change Log CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redirected stderr output causes $? to be set to $false, even if the process exit code is 0

5 participants