Skip to content
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

.ps1 shims don't work as expected with PowerShell 7 chain operators #3850

Closed
ocitrev opened this issue Feb 14, 2020 · 2 comments
Closed

.ps1 shims don't work as expected with PowerShell 7 chain operators #3850

ocitrev opened this issue Feb 14, 2020 · 2 comments

Comments

@ocitrev
Copy link
Contributor

ocitrev commented Feb 14, 2020

With PowerShell 7 you can use chain operators. Without a proper value in $? it does not work as expected.

When I run this command line:

PS> should-fail || echo "Failed"

I get no output.
With current shims, PowerShell always see success (with automatic variable $?) when running .ps1 shims.

As a workaround, I can add .exe to the name of the command. This will bypass the .ps1 shim and work as expected.

PS> should-fail.exe || echo "Failed"
Failed
@ocitrev
Copy link
Contributor Author

ocitrev commented Feb 14, 2020

In case any one wants to try should-fail.exe, here is the source code.

int main() { return 1; }

@rashil2000
Copy link
Member

Merged in develop branch - #4543

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

No branches or pull requests

2 participants