Windows finally gets a real PTY
-
Pretty interesting article, by the Microsoft team tasked with de-deprecating Windows console system.
They are revealing that a "real" PTY infrastructure will come to Windows in the next major update. FINALLY.
The most interesting thing for me was how fucking awful the current conhost system is. Apparently, in order to get a 3rd party terminal app or a remote shell (like SSH) going, you need to instantiate that crappy console app, hide it / move it off screen, and then scrape the fucking text off the output buffer and pretend write into-it. And yes, that's how Microsoft's official openssh implementation works too.
Jeesh. I mean, they are trying to put a brave face on it ("there are ups and downs to every decision, blah blah blah"), but history has pretty clearly shown unix made all the right decisions when designing their CLI story, while Microsoft made all the wrong ones.
-
Windows is also a real PIA.
-
@cartman82 said in Windows finally gets a real PTY:
And yes, that's how Microsoft's official openssh implementation works too.
It is either that or using debugging tools to attach to the slave processes behind the scenes, which is truly horrific. (And what Expect for Windows does. And it doesn't work for some programs because they are marked specially as non-debuggable.)
Before anyone asks, yes, PTYs are also pretty tricky, but nowhere near as bad as pretending to be a debugger...
-
@cartman82 said in Windows finally gets a real PTY:
Jeesh. I mean, they are trying to put a brave face on it ("there are ups and downs to every decision, blah blah blah"), but history has pretty clearly shown unix made all the right decisions when designing their CLI story, while Microsoft made all the wrong ones.
Oh come on that's bullshit. Linux made the decision that "the only data that matters is plain text" which is objectively completely wrong and stupid, as PowerShell has shown. Treating complicated hardware devices, like video capture cards with FM receivers, as files was an objectively wrong and stupid decision. Not specifying any limitations on file names (specifically, allowing control characters and the same characters used for CLI flags in file names), so that it's virtually impossible to write a shell script that can receive a list of files on all POSIX-compatible systems is an objectively wrong and stupid decision.
That's not to say Windows has done everything right. But you have to remember the Windows story with automation went:
DOS -> CMD -> WSH (Windows Scripting Host, JScript or VBScript) -> PowerShell -> ... this?
While Linux people were using Vi to edit fucking text files, WSH had a full IDE with a macro recorder and a working debugger. Night and fucking day difference in ease of development.
For some reason people, especially open source fan people, tend to ignore that the blessed solution for automating tasks in Windows from like 1998 - 2012 or whatever even existed.
So yes, if you have a personal timeline that COMPLETELY IGNORES WSH, then it looks like Microsoft had a huge gap in functionality between about 1998 and 2012 or whatever. But if you're one of us people who lives here in reality and isn't completely ignorant, then you realize: actually Windows' scripting story has been pretty damned good for its entire existence.
-
@blakeyrat said in Windows finally gets a real PTY:
Linux made the decision
False. That decision had been made.
@blakeyrat said in Windows finally gets a real PTY:
you have to remember the Windows story
sucked all of the ass and I mean, all of the ass? That's the joke.
-
@cartman82 said in Windows finally gets a real PTY:
Apparently, in order to get a 3rd party terminal app or a remote shell (like SSH) going, you need to instantiate that crappy console app, hide it / move it off screen, and then scrape the fucking text off the output buffer and pretend write into-it. And yes, that's how Microsoft's official openssh implementation works too.
At the risk of showing my ignorance: But why?
Windows has pipes / named pipes for IPC, which are basically everything you need. Hook up an input and an output pipe to your program and you've got the building blocks for stdin / stdout. Then you can write a nicer terminal emulator to display that.
Of course, that won't work with normal console apps, as they're designed to work with the windows console API instead, but if you're already writing both ssh and the terminal emulator, you control everything you need.EDIT: I took "3rd party terminal app" to mean "replacement for the console" you wrote yourself. If I got that wrong, then you obviously don't control both parts.
-
@topspin I know I've used ProcessBuilder on Windows platforms, which gives me std(in|out|err), but I've never checked to see whether it is sane under the covers, because I already know when I'm running on Windows.
-
@topspin said in Windows finally gets a real PTY:
@cartman82 said in Windows finally gets a real PTY:
Apparently, in order to get a 3rd party terminal app or a remote shell (like SSH) going, you need to instantiate that crappy console app, hide it / move it off screen, and then scrape the fucking text off the output buffer and pretend write into-it. And yes, that's how Microsoft's official openssh implementation works too.
At the risk of showing my ignorance: But why?
Windows has pipes / named pipes for IPC, which are basically everything you need. Hook up an input and an output pipe to your program and you've got the building blocks for stdin / stdout. Then you can write a nicer terminal emulator to display that.
Of course, that won't work with normal console apps, as they're designed to work with the windows console API instead, but if you're already writing both ssh and the terminal emulator, you control everything you need.EDIT: I took "3rd party terminal app" to mean "replacement for the console" you wrote yourself. If I got that wrong, then you obviously don't control both parts.
I expect a windows SSH client like putty does indeed ignore the windows console completely. The crux is in replacements for the windows console or windows SSH servers which have to deal with arbitrary windows command line applications.
-
@Gribnit said in Windows finally gets a real PTY:
False. That decision had been made.
Linux decided to stick with it all these years. That's as important as designing the system.
-
@anonymous234 they could have decided to abandon POSIX, but they didn't?
-
@dkf said in Windows finally gets a real PTY:
It is either that or using debugging tools to attach to the slave processes behind the scenes, which is truly horrific. (And what Expect for Windows does. And it doesn't work for some programs because they are marked specially as non-debuggable.)
They say they are scraping the output.
-
@Gribnit said in Windows finally gets a real PTY:
@anonymous234 they could have decided to abandon POSIX, but they didn't?
Bad is bad. It doesn't matter if it's bad and old or bad and new.
And it's hard to believe that between 1991 and 2018 there hasn't been ONE THING in POSIX that's been generally agreed-upon to be a bad idea that should be changed.
-
It took Windows like 35 years to catch up with Unix, presumably because the simplifications and abstractions Bell Labs made were useful.
Bad is bad.
-
@Captain said in Windows finally gets a real PTY:
It took Windows like 35 years to catch up with Unix,
"catch-up" how? In what way was Windows NT not "caught-up" with Unix?
-
@blakeyrat "Windows finally gets a real PTY".
Also, server marketshare.
And phone OSes.
And supercomputing.
And big data.
-
@Captain Also dogs with white fur.
And 5-speed cars.
And listing random things that have nothing to do with anything.
And coffee ice cream.
-
@blakeyrat I'm pretty sure you made those all up, whereas linux runs about 96% of the servers on the internet, the vast majority of super computers, a sizeable chunk of the phone market, and virtually all of the big data rigs.
Why? Because it gets out of the professional's way.
-
@Captain PHP has been running most of the internet for two decades, but all it proves is that you can run internet on anything.
-
Previous discussion in https://what.thedailywtf.com/post/1380204 and replies.
(Yes, I know it was an earlier article so it's not a . But I could have sworn I'd seen this discussion before including the screen-scraping discussion and needed to know I wasn't going crazy. Hopefully I can give someone else the same assurance. :P)
-
@heterodox this forum has been running long enough that we've probably had every single possible discussion carried out already.
-
@blakeyrat said in Windows finally gets a real PTY:
While Linux people were using Vi to edit fucking text files, WSH had a full IDE with a macro recorder and a working debugger. Night and fucking day difference in ease of development.
Hmm...what I remember from the application I was working on in the late 90s/early 2000s was Microsoft wanting you to purchase and integrate the VBA engine and its recording system into your GUI application. You couldn't do squat for recording without either integrating VBA or having Office installed and running Office's Script Editor, and both of those could only record an application that supported the VBA recording interfaces. Implementing IDispatch forms of your interfaces (assuming you were already writing an application with COM support) wasn't too bad in most cases, but that didn't get you recordability.
Adding to the timeline, in the .NET era you get the Visual Studio Tools for Applications replacing the embedded form of VBA and the Community editions of the various parts of Visual Studio giving everyone a GUI development environment. Both came out not too long after PowerShell.
-
@Gąska said in Windows finally gets a real PTY:
@heterodox this forum has been running long enough that we've probably had every single possible discussion carried out already.
I doubt it. Care to give some examples?
-
@pie_flavor scriptability of GUI vs. CLI was a heated topic last summer (feat. Blakey of course) though that time around it was about AppleScript (but VBScript was mentioned too).
-
-
@pie_flavor It's 5AM in the morning. Cut me some slack.
-
@Gąska You shouldn't be on slack at 5 AM; you should be asleep.
-
@HardwareGeek said in Windows finally gets a real PTY:
@Gąska You shouldn't be on slack
at 5 AM; you should be asleep.FTFY
-
@blakeyrat said in Windows finally gets a real PTY:
So yes, if you have a personal timeline that COMPLETELY IGNORES WSH, then it looks like Microsoft had a huge gap in functionality between about 1998 and 2012 or whatever. But if you're one of us people who lives here in reality and isn't completely ignorant, then you realize: actually Windows' scripting story has been pretty damned good for its entire existence.
Microsoft's scripting story is great according to Blakeyrat, but not according to Microsoft itself, that is now slowly throwing away all their custom object-oriented crap from the NT days and adopting concepts from unix. Gotcha.
-
@topspin yes they have some pipes, but it seems they hardcoded it so that kernel does all the plumbing instead of the client. So kernel needs to know which "blessed" app to start, instead of having an open pipe system where anyone can connect.
-
@Gąska said in Windows finally gets a real PTY:
@heterodox this forum has been running long enough that we've probably had every single possible discussion carried out already.
You’re saying we’ve found the infinite number of monkeys, and it turns out to be us?
-
@Gąska Yeah but everyone keeps intentionally misunderstanding the other side so they never go anywhere.
-
@cartman82 said in Windows finally gets a real PTY:
@blakeyrat said in Windows finally gets a real PTY:
So yes, if you have a personal timeline that COMPLETELY IGNORES WSH, then it looks like Microsoft had a huge gap in functionality between about 1998 and 2012 or whatever. But if you're one of us people who lives here in reality and isn't completely ignorant, then you realize: actually Windows' scripting story has been pretty damned good for its entire existence.
Microsoft's scripting story is great according to Blakeyrat, but not according to Microsoft itself, that is now slowly throwing away all their custom object-oriented crap from the NT days and adopting concepts from unix. Gotcha.
Well, they also tried to replace Visual Studio with the Notepad clone known as VSCode...
-
@Gąska said in Windows finally gets a real PTY:
@cartman82 said in Windows finally gets a real PTY:
@blakeyrat said in Windows finally gets a real PTY:
So yes, if you have a personal timeline that COMPLETELY IGNORES WSH, then it looks like Microsoft had a huge gap in functionality between about 1998 and 2012 or whatever. But if you're one of us people who lives here in reality and isn't completely ignorant, then you realize: actually Windows' scripting story has been pretty damned good for its entire existence.
Microsoft's scripting story is great according to Blakeyrat, but not according to Microsoft itself, that is now slowly throwing away all their custom object-oriented crap from the NT days and adopting concepts from unix. Gotcha.
Well, they also tried to replace Visual Studio with the Notepad clone known as VSCode...
"Tried". Implicating they failed.
-
@cartman82 implicating they once thought it was good idea, not so long ago.
-
@Gąska said in Windows finally gets a real PTY:
@cartman82 implicating they once thought it was good idea, not so long ago.
Implicating they don't anymore.
-
@cartman82 and yet they still push the .Net Core thing. Excuse me while I keep being skeptical of their judgement for the time being.
-
@Gąska said in Windows finally gets a real PTY:
It's 5AM in the morning. Cut me some slack.
5AM in the evening is worse.
-
@cartman82 WSL is great, what is everyone talking about?
-
@cartman82 said in Windows finally gets a real PTY:
Implicating
@Gąska said in Windows finally gets a real PTY:
implicating
@cartman82 said in Windows finally gets a real PTY:
Implicating
The word you want is "implying." "Implicate" means "show (someone) to be involved in a crime," which may be what you're implying about MS, but probably not.
Toby Faire, "implicate" can also be a synomym of "imply," so you're not really wrong, but it's a "recondite" usage, according to this SE discussion, which agrees with my experience; I've rarely if ever heard it used that way.
-
@Gąska said in Windows finally gets a real PTY:
@cartman82 and yet they still push the .Net Core thing. Excuse me while I keep being skeptical of their judgement for the time being.
Sounds like you haven't taken your Azure!
-
@HardwareGeek said in Windows finally gets a real PTY:
@cartman82 said in Windows finally gets a real PTY:
Implicating
@Gąska said in Windows finally gets a real PTY:
implicating
@cartman82 said in Windows finally gets a real PTY:
Implicating
The word you want is "implying." "Implicate" means "show (someone) to be involved in a crime," which may be what you're implying about MS, but probably not.
We're ESLs. I hate to repeat myself, but cut us some slack.
-
@Gąska I know. I'm just trying to be helpful and informative (and ic), not critical.
-
@cartman82 said in Windows finally gets a real PTY:
@blakeyrat said in Windows finally gets a real PTY:
So yes, if you have a personal timeline that COMPLETELY IGNORES WSH, then it looks like Microsoft had a huge gap in functionality between about 1998 and 2012 or whatever. But if you're one of us people who lives here in reality and isn't completely ignorant, then you realize: actually Windows' scripting story has been pretty damned good for its entire existence.
Microsoft's scripting story is great according to Blakeyrat, but not according to Microsoft itself, that is now slowly throwing away all their custom object-oriented crap from the NT days and adopting concepts from unix. Gotcha.
Said no one ever. Who's throwing things away?
-
@cartman82 said in Windows finally gets a real PTY:
Microsoft's scripting story is great according to Blakeyrat, but not according to Microsoft itself, that is now slowly throwing away all their custom object-oriented crap from the NT days and adopting concepts from unix. Gotcha.
What's being thrown away? All the scripting objects PowerShell talks to are wrappers around the WSH ones that have been there forever.
What concepts are being adopted from Unix? (That weren't already in CMD and WSH?)
-
@blakeyrat said in Windows finally gets a real PTY:
What's being thrown away? All the scripting objects PowerShell talks to are wrappers around the WSH ones that have been there forever.
What concepts are being adopted from Unix? (That weren't already in CMD and WSH?)Like... the central point of the article? ConPTY interface?
Yeah, sure, they can't throw away all this awful crap they've accumulated, but they are sure trying to bury it as deep as possible.
-
@El_Heffe said in Windows finally gets a real PTY:
@Gąska said in Windows finally gets a real PTY:
It's 5AM in the morning. Cut me some slack.
5AM in the evening is worse.
In my experience, that depends on whether you just took a flight eastward or westward.
-
@Gurth whether you're flying eastwards or westwards, I hope you have a plane.
-
@Gąska said in Windows finally gets a real PTY:
@Gurth whether you're flying eastwards or westwards, I hope you have a plane.
Well, you might be in CA (or WA, OR, NV, CO, AK, ME, VT, MA¹) still...
¹Damn, this joke is getting harder to do...
-
@Gąska said in Windows finally gets a real PTY:
@Gurth whether you're flying eastwards or westwards, I hope you have a plane.
Nah, I could never afford one. In any case, it’s far cheaper when other people have a plane and you pay them so they let you travel on it. Preferably, you do this together with a few hundred others who have approximately the same destination as you do.
-