Skip to content

Conversation

@daxian-dbw
Copy link
Member

PR Summary

Fix #15651

PowerShell automatically adds 'Out-Default -Transcript' to the end of pipeline when it's transcribing and invoked via API. When -Transcript is specified, objects passed through are transcribed but are not passed ahead to the host.

The PowerShell sub-kernel actually already adds Out-Default to pass output to host, however, we have to use Out-Default2 as the name due to a limitation in the native command processor. Since we are using Out-Default2, PowerShell believes it doesn't have the Out-Default command at the end, and thus adds Out-Default -Transcript automatically, 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 the Out-Default name, but also check whether the ImplementingType is typeof(OutDefaultCommand).

This PR also refactors the code a bit, to calculate needToAddOutDefault only if PowerShell is transcribing.

PR Checklist

Copy link
Contributor

@PaulHigin PaulHigin left a comment

Choose a reason for hiding this comment

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

LGTM

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Jun 24, 2021
@daxian-dbw
Copy link
Member Author

daxian-dbw commented Jun 28, 2021

BackPort-7.1.x-Consider context: this issue causes the PowerShell sub-kernel in .NET interactive to not work with Start-Transcript. Once the transcribing starts, a user of PowerShell notebook won't be able to see any output when running commands in the notebook. The .NET interactive is currently using PowerShell 7.1.3 NuGet packages.

@daxian-dbw
Copy link
Member Author

@adityapatwardhan Can you please review and see if we can merge this one?

@adityapatwardhan adityapatwardhan merged commit 14f25c9 into PowerShell:master Jun 28, 2021
@adityapatwardhan adityapatwardhan added this to the 7.2.0-preview.8 milestone Jun 28, 2021
@adityapatwardhan adityapatwardhan added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Jun 28, 2021
@daxian-dbw daxian-dbw deleted the outdefault branch July 2, 2021 22:38
@ghost
Copy link

ghost commented Jul 22, 2021

🎉v7.2.0-preview.8 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

ghost commented Oct 14, 2021

🎉v7.1.5 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

BackPort-7.1.x-Done Backport to 7.1.x completed 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.

Start-Transcript in Powershell .NET Interactive notebook hides future output

5 participants