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

Force the use of v2 (non-legacy) conhost when in ConPTY mode #1935

Merged
merged 1 commit into from
Jul 12, 2019

Conversation

DHowett-MSFT
Copy link
Contributor

Fixes #1838.

Summary of the Pull Request

This pull request ensures that conhost, when started in conpty mode (that is: with a signal pipe, an inPipe or an outPipe (the latter two of which are no longer supported)), launches in modern v2 mode and doesn't delegate to ConhostV1.dll.

PR Checklist

Detailed Description of the Pull Request / Additional comments

I chose to move the check into ShouldUseLegacyConhost, but it could equally well belong in ShouldUseConhostV2. Right now, "ShouldUse...V2" is dedicated to checking the registry. It's simple to change it, but this seemed like the most scoped change.
The narrow scope of the change is intentional: perhaps we can try to service this because it represents a complete scenario breakage.

Validation Steps Performed

Manually replaced conhost on my machine and attempted to launch a pseudoconsole with pwincon while legacy mode was engaged.

@zadjii-msft zadjii-msft added the Product-Conpty For console issues specifically related to conpty label Jul 12, 2019
Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

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

Approved with commentary. I trust you to fix it before check-in.

{
return fForceV1 || !ShouldUseConhostV2();
return (args.GetForceV1() || !ShouldUseConhostV2()) && !args.InConptyMode();
Copy link
Member

Choose a reason for hiding this comment

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

OK this is what we need, but can you make this a little less mentally stressful to read like

if (args.InConptyMode())
{
     return false;
}
// etc...

Also, if you think ShouldUseConhostV2 is poorly named, please just rename it right now to be DoesRegistryPrefSayUseConhostV2 or something to clarify it's just the registry lookup and not something more elaborate than that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hate that the most ideal name for that function is IsConhostV2NotForcedOffInRegistry (because it's unset or nonzero = v2, but set to 0 = v1)

Copy link
Contributor

Choose a reason for hiding this comment

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

DoesRegistryForceConhostV1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not unreasonable. I want to keep the change scoped down so that it's more easily serviceable, though, and that requires us to flip the sense on the function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Admittedly, it is clearer.

@ghost
Copy link

ghost commented Aug 3, 2019

🎉Windows Terminal Preview v0.3.2142.0 has been released which incorporates this pull request.:tada:

Handy links:

DHowett-MSFT pushed a commit that referenced this pull request Aug 6, 2019
…onPTY mode (#1935)

Force the use of v2 (non-legacy) conhost when in ConPTY mode (#1935)

Fixes #1838.

Related work items: #22981851
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product-Conpty For console issues specifically related to conpty
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use legacy console option prevents Terminal from launching ConPTYs correctly
5 participants