TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Introducing the Windows Pseudo Console (ConPty)

297 pointsby mnkypetealmost 7 years ago

22 comments

ChuckMcMalmost 7 years ago
This is pretty huge. For as long as I can remember the response to command line applications talking to command line applications was "Why would you want to do that? Use (RPC | shared memory | some other IPC mechanism)." And nobody at Microsoft seemed to understand how much simpler it was to use ptys. They seem to have completely capitulated to the notion ptys and are dropping them into the next release of W10. I wish this had happened 10 years ago but hey, I'll take it.
评论 #17771329 未加载
评论 #17772608 未加载
评论 #17772117 未加载
评论 #17771858 未加载
cafalmost 7 years ago
Will there be a terminfo database entry for ConPty? What TERM string should we expect to see?<p>To elaborate: although an ordinary POSIX pty doesn&#x27;t inherently have a terminal type - that&#x27;s entirely down to whatever emulator is connected to the master side - the way the ConPty system translates Console API calls into terminal control codes means that it necessarily needs to pick a terminal emulation, which all actors in the ConPty system are expected to use.<p>A terminfo database entry would be useful both for applications running on *NIX hosts but displaying on a remote ConPty master somewhere, as well as for porting existing terminal applications to Windows where they will run on a ConPty slave.<p>As a follow-up question, presumably this means that the SSHD running on Windows as a ConPty master needs to translate between whatever terminal emulation the ssh client is connected to and the one expected by ConPty &#x2F; ConPty apps (in the same way it must translate between the native ConPty UTF-8 and the remote charset)?
评论 #17776213 未加载
评论 #17771865 未加载
评论 #17771937 未加载
评论 #17771424 未加载
cryptonectoralmost 7 years ago
What next? Job control signals?? :) (EDIT: How about tmux?)<p>Anyways, this is fantastic. Finally, proper ssh functionality!<p>This will encourage development of console (text-oriented) apps for Windows, which I hope will be much simpler. Interfacing with the console can be really difficult if you&#x27;re coming from *nix. Ideally all the WIN32-specific code in, e.g., jq[0], could be ripped out.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;stedolan&#x2F;jq" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;stedolan&#x2F;jq</a> (look in src&#x2F;main.c)
评论 #17770704 未加载
评论 #17772828 未加载
amlutoalmost 7 years ago
For me, the most surprising thing is that the new PTY devices use UTF-8. Not UTF-16 or UCS-2 or weird little endian variants thereof, and not even wchar_t.<p>This is so un-Windows-like.
评论 #17771052 未加载
评论 #17771334 未加载
JdeBPalmost 7 years ago
I&#x27;ve been waiting for two decades to revise this particular Frequently Given Answer.<p>* <a href="http:&#x2F;&#x2F;jdebp.info.&#x2F;FGA&#x2F;capture-console-win32.html" rel="nofollow">http:&#x2F;&#x2F;jdebp.info.&#x2F;FGA&#x2F;capture-console-win32.html</a>
评论 #17772507 未加载
zadjiialmost 7 years ago
Hey I&#x27;m one of the Console devs who&#x27;s been working on this feature for a while now. I&#x27;ll be hanging around in the comments for a little while to try and answer any questions that people might have.<p>TL;DR of this announcement: We&#x27;ve added a new pseudoconsole feature to the Windows Console that will the people create &quot;Terminal&quot; applications on Windows very similarly to how they work on *nix. Terminals will be able to interact with the conpty using only a stream of characters, while commandline applications will be able to keep using the entire console API surface as they always have.
评论 #17770136 未加载
评论 #17770244 未加载
评论 #17770907 未加载
评论 #17770498 未加载
评论 #17769361 未加载
评论 #17770593 未加载
评论 #17769789 未加载
评论 #17769857 未加载
asveikaualmost 7 years ago
While we&#x27;re talking Unixisms, Windows needs a dup2(2). That is, given a HANDLE, you should be able to swap out its backing kernel data structure with that of another HANDLE.<p>Without this, I&#x2F;O redirection is slightly broken. Last I checked you can&#x27;t change where stderr goes after the process starts, for example. [SetStdHandle doesn&#x27;t do it at the right layer.]
hoppelhasealmost 7 years ago
I always liked the Console API where you can set the color of the text without actually changing the text that is written to Stdout. No issues when piping the output somewhere else. No need to check whether the output is getting piped.
评论 #17771125 未加载
quotemstralmost 7 years ago
Finally! I&#x27;ve been waiting ten years or so for this API. It&#x27;s about time that alternative terminal emulation becomes possible on Windows.
hoppelhasealmost 7 years ago
If I use the System.Process API in .NET and redirect the Stdin&#x2F;Stdout to a stream inside my application, does the framework spawn an invisible console and scrape the output? Or does this work differently? I always did it that way and thought the 3rd party terminal emulators also do that. Why do these emulators have to do it differently?
评论 #17770568 未加载
exikyutalmost 7 years ago
Wow. I remember the photo miniksa posted to GitHub when this was in process:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Microsoft&#x2F;WSL&#x2F;issues&#x2F;111#issuecomment-238592841" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Microsoft&#x2F;WSL&#x2F;issues&#x2F;111#issuecomment-238...</a><p><i>Awesome</i> to see it&#x27;s finally up and running! \o&#x2F;
borekbalmost 7 years ago
I currently use ConEmu + zsh via MSYS2 as my preferred shell on Windows. I need to run many interactive programs like `python`, `node` etc. via winpty, e.g.:<p>``` alias node=&#x27;winpty node.cmd&#x27; ```<p>With the new ConPTY, will I be able to run native Windows programs directly? If so, that would be huge, winpty (while I&#x27;m really thankful it exists) is a PITA in practice, see e.g. <a href="https:&#x2F;&#x2F;github.com&#x2F;Microsoft&#x2F;vscode&#x2F;issues&#x2F;45693" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Microsoft&#x2F;vscode&#x2F;issues&#x2F;45693</a>.
linuxlizardalmost 7 years ago
This is very exciting. I&#x27;m looking forward to seeing where it goes.
mschuster91almost 7 years ago
Is there any way to get this backported to Windows 7 - or run a W7 userland on top of a W10 kernel? I&#x27;m actually serious about this one, I can&#x27;t stand this semi-&quot;mobile-first&quot;, flat UI of newer Windows generations, and the privacy invasions and ads are other hard blockers for me - but that WSL layer or the new console subsystem seem to be pretty nice features.
red75primealmost 7 years ago
I hope control-S (XOFF) is disabled by default.
voltagex_almost 7 years ago
Wow, there might be able to be a proper ncurses port now!
评论 #17775803 未加载
评论 #17773282 未加载
docodealmost 7 years ago
Where can we try a .NET solution with this ConPty?
mobilehnuseralmost 7 years ago
Thanks to WSL and this, I&#x27;m very hopeful that my next development laptop can be a windows device
21almost 7 years ago
Does this mean that it will now be easy to port terminator to windows?
评论 #17770748 未加载
nasoieualmost 7 years ago
Something looks very eerie in that Admiral Grace Hopper picture. Is it shopped?
kpilalmost 7 years ago
-- Those who don&#x27;t understand Unix are condemned to reinvent it, poorly. Henry Spencer
评论 #17772869 未加载
评论 #17773907 未加载
partycoderalmost 7 years ago
<p><pre><code> HRESULT WINAPI ResizePseudoConsole(_In_ HPCON hPC, _In_ COORD size); </code></pre> If Microsoft is in the mood to fix old problems, right ^there you&#x27;ve got another old problem: its bizarre API that is different to everything else. Designed that way to lock everyone into their OS.<p>In 2018 nobody has the time to learn this. Just use a cross-platform API and if it doesn&#x27;t run on Windows then just don&#x27;t run Windows.<p>As a developer, using Windows for development is against your own best interest. If you like to be treated as a dog that is not allowed inside the house, use Windows.
评论 #17771829 未加载
评论 #17775831 未加载