Microsoft Discovers The Command Line

A review <https://www.theregister.co.uk/2019/06/25/microsofts_new_terminal_put_through_paces/> of Microsoft’s revamped Windows Terminal app. Features like session tabs and customizable profiles should be familiar to users of Linux terminal apps. The biggest downside seems to be that this is a UWP app, which means it only works with specific versions of Window 10. Actually, Windows had a sort-of-remotable/virtualizable-command-line support before. The difference is, all the *nix-type systems implement this using “PTY” (“pseudo-terminal”) devices, which one process (like an SSH server or GUI terminal emulator) can open and use to drive other processes on the other side, which act as though they are connecting to a real terminal. All the fancy screen stuff (e.g. direct addressing, coloured text) is done by sending in-band “escape sequences”, which real terminals (which are all museum pieces now) used to respond to, and which the terminal emulators nowadays faithfully mimic. However, Microsoft didn’t like the whole escape-sequence idea; instead, it implemented a whole API it called “ConHost”, where the application had to make special calls to affect the display in special ways. This sounds more advanced than the crude-sounding escape-sequence idea from the 1970s, yet it turns out that the Microsoft approach makes it awkward to implement those same SSH servers and GUI terminal emulators that we take for granted in the Linux world. So now the company is back-pedalling away from that, and towards good old PTYs and escape sequences, in its new “ConPTY” architecture. There is still one issue I don’t think they’ve addressed yet, though <https://forums.theregister.co.uk/forum/all/2019/06/25/microsofts_new_terminal_put_through_paces/#c_3811206>: ... a working select() would be nice. MS's function cannot wait across a set of fd's of different types (such as a serial port and a network socket). In the end I gave up and used the cygwin platform, which has a working select(), which was enough to do the job of talking to a telehone exchange via RS232 and fielding network requests at the same time. The unix philosophy that at the end of the day, everything is a file, pays huge dividends. Using cygwin also gave me a nice simple tcgetattr()/tcsetattr() which allowed serial port setup in a tiny amount of code, compared to the sheer lovecraftian horror that is the windows API for such things. I still find it remarkable that the Cygwin folks were able to implement a function on top of Windows that Microsoft itself seems unable to figure out.

I still find it remarkable that the Cygwin folks were able to implement a function on top of Windows that Microsoft itself seems unable to figure out.
You do wonder, how much of a "clean room" development this new command prompt is. Or how much "inspiration" (copy/paste *coughcough*) is taken from open source projects... Cheers, Peter -- Peter Reutemann Dept. of Computer Science University of Waikato, NZ +64 (7) 858-5174 http://www.cms.waikato.ac.nz/~fracpete/ http://www.data-mining.co.nz/
participants (2)
-
Lawrence D'Oliveiro
-
Peter Reutemann