Skip to content

Fix crash if command sent to pwsh is just whitespace #10977

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 2 commits into from
Nov 4, 2019

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Nov 2, 2019

PR Summary

In the early parsing code, a null switchkey can be returned. This isn't expected in later code resulting in an unhandled exception. Fix is to check if switchkey is null before additoinal processing. In this case, just whitespace is sent to PowerShell whereas an empty string returns an error.

PR Context

Fix #10975

PR Checklist

Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

LGTM

@anmenaga anmenaga added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 4, 2019
@anmenaga anmenaga added this to the 7.0.0-preview.6 milestone Nov 4, 2019
@anmenaga anmenaga merged commit baf2410 into PowerShell:master Nov 4, 2019
@ghost
Copy link

ghost commented Nov 21, 2019

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

@SteveL-MSFT SteveL-MSFT deleted the pwsh-whitespace-arg branch June 6, 2020 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PowerShell can't handle empty commandline parameter
5 participants