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

Windows ConPTY support and native Windows programs? #804

Closed
nojb opened this issue Oct 3, 2018 · 20 comments
Closed

Windows ConPTY support and native Windows programs? #804

nojb opened this issue Oct 3, 2018 · 20 comments
Labels

Comments

@nojb
Copy link

nojb commented Oct 3, 2018

Would it be possible to use the recently introduced ConPTY API (https://blogs.msdn.microsoft.com/commandline/2018/08/02/windows-command-line-introducing-the-windows-pseudo-console-conpty/) to improve the compatibility of mintty with native Windows programs (esp. interactive ones)?

@mintty
Copy link
Owner

mintty commented Oct 3, 2018

It's been announced for a while already but documentation is not yet available.
Anyway, this might be an enhancement for cygwin, but not for mintty, because that's the platform level where this kind of interoperability issue can be handled.

@mintty mintty added the question label Oct 3, 2018
@nojb
Copy link
Author

nojb commented Oct 3, 2018

Thanks for the reply @mintty! I will ask in Cygwin's mailing list about it.

@nojb nojb closed this as completed Oct 3, 2018
@Biswa96
Copy link
Contributor

Biswa96 commented Oct 3, 2018

@nojb If you do that please share the link of that mail.

@nojb
Copy link
Author

nojb commented Oct 3, 2018

@Biswa96
Copy link
Contributor

Biswa96 commented Oct 3, 2018

@nojb You mentioned about native Windows Applications. But its not the case. No native console app use that CONPTY. Windows Console team mimics the PTY connection like in *nix systems in a whole different way.

@nojb
Copy link
Author

nojb commented Oct 3, 2018

Not sure I understand your objection, but if you look at the section ConHost - Investing in yesterday for tomorrow in the linked blog post, you will see it clearly states that this API can be used to make traditional, existing Console applications behave like typical Unix terminal applications (VT codes, etc.).

@fcharlie
Copy link

fcharlie commented Sep 3, 2019

An exciting news, cygwin currently supports conpty. see commit: bminor/newlib@169d65a

@mintty
Copy link
Owner

mintty commented Sep 3, 2019

Yes, but note it's still a test release. We'll have to wait another few weeks until the official cygwin release.
And then I can close all the related issues here!

@fpqc
Copy link

fpqc commented Sep 27, 2019

@mintty Does this mean you won't need to use the bridge anymore?

@mintty
Copy link
Owner

mintty commented Sep 27, 2019

Yes.

@fpqc
Copy link

fpqc commented Sep 27, 2019

@mintty By the way, you might find this interesting:

In the newer builds of windows, you know how you can access the linux filesystem from:
\\wsl$\<distroname>

well, if you set up your mintty shortcut for wsltty to start in:

\\wsl$\<distroname>\home\<wslusername>

you can omit the ~ parameter from wsl.exe.

Here's a screenshot:

image

I just got it working with hvpty, but it works because of wsl.exe now automatically translating the \\wsl$\<Distroname> paths automatically. This should make escaping parameters much easier and also obviate the need for a 'wsldir' or anything of that nature.

@mintty
Copy link
Owner

mintty commented Sep 27, 2019

The \\wsl$\ thing is interesting information, thanks, but of limited value. You wouldn't normally know the <wslusername>.

@Biswa96
Copy link
Contributor

Biswa96 commented Sep 27, 2019

The path \\wsl$\<Distroname> is only valid when a WSL session is running. So, there may be some race condition between hvpty.exe execution (which executes wsl.exe) and the path translation. hvpty and wslbridge2 already have a wsldir and windir option.

@fpqc
Copy link

fpqc commented Sep 27, 2019

@Biswa96 nope. It's always valid. It was in the recent video on the blog. They actually launch an instance of wsl if you try to connect and it's not present. You can try it yourself if you don't believe me.

Also, see microsoft/terminal#2931 (comment) and the following comment by me with the correction.

@fpqc
Copy link

fpqc commented Sep 27, 2019

@mintty By the way, a consequence of \\wsl?\Distroname always being available is that you can just read /etc/passwd directly from windows to get all of that information.

@Biswa96
Copy link
Contributor

Biswa96 commented Sep 27, 2019

May be it possible but I can't in my PC. Also the path is not available in older Windows 10 versions. I think its user who has to configure their own shortcuts. After all, hvpty & wslbridge2 do have the option to change WSL side path from commandline.

@fpqc
Copy link

fpqc commented Sep 27, 2019

@Biswa96 Ah, ok, it does work on the most recent two fast ring builds. I don't know about slow ring.

@mintty
Copy link
Owner

mintty commented Dec 16, 2019

Cygwin 3.1.0 has been released with ConPTY support.

@pagerc
Copy link

pagerc commented Jun 9, 2020

The \\wsl$\ thing is interesting information, thanks, but of limited value. You wouldn't normally know the <wslusername>.

Sorry for commenting on a closed issue, but thought this might have relevance to anyone reviewing this thread in the future.
It's possible to access the Windows environment variables from the path, so this is a good alternative to setting the -~ option.
\\wsl$\Ubuntu\home\%USER%

@mintty
Copy link
Owner

mintty commented Jun 9, 2020

Fixing syntax and variable reference, that would be
\\wsl$\Ubuntu\home\%USERNAME%
where the actual distribution name seems to be ignored which is weird. -~ works better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants