-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Test if a command is 'Out-Default' more thoroughly #15653
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
Conversation
PaulHigin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
BackPort-7.1.x-Consider context: this issue causes the PowerShell sub-kernel in .NET interactive to not work with |
|
@adityapatwardhan Can you please review and see if we can merge this one? |
|
🎉 Handy links: |
|
🎉 Handy links: |
PR Summary
Fix #15651
PowerShell automatically adds 'Out-Default -Transcript' to the end of pipeline when it's transcribing and invoked via API. When
-Transcriptis specified, objects passed through are transcribed but are not passed ahead to the host.The PowerShell sub-kernel actually already adds
Out-Defaultto pass output to host, however, we have to useOut-Default2as the name due to a limitation in the native command processor. Since we are usingOut-Default2, PowerShell believes it doesn't have theOut-Defaultcommand at the end, and thus addsOut-Default -Transcriptautomatically, which prevents sending anything to the host and hence you don't see output from PowerShell sub-kernel when the transcription is turned on.This needs to be fixed in the
InvokeHelper()method, to not just check for theOut-Defaultname, but also check whether theImplementingTypeistypeof(OutDefaultCommand).This PR also refactors the code a bit, to calculate
needToAddOutDefaultonly if PowerShell is transcribing.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.