Microsoft Answers Developer Calls for Linux-Like Pseudo Console in Windows
"We've heard from many, many developers, who've frequently requested a PTY-like mechanism in Windows," said Microsoft exec Rich Turner in a recent blog post announcing a Windows Pseudo Console (ConPTY) coming to Windows 10.
This "back to the future" move will make it easier for developers to connect their command-line and graphical user interface (GUI)-based applications. Turner said the many developers requesting such functionality included those who work on developing the Visual Studio IDE and the Visual Studio Code editor, along with terminal and command-line coders.
Unlike *NIX operating systems, Windows currently lacks a pseudo console. It doesn't speak the "text/VT" language that was used to support terminal communications in *NIX operating systems. As a consequence, Windows currently "obstructs third-party consoles and server apps." Windows goes through the gyrations of creating an off-screen console to scrape and resend the output using a so-called "Console API."
This lack of a pseudo console in Windows has just led to problems, including "instability, crashes, data corruption, excessive power consumption," among others, according to Turner, a senior program manager at Microsoft, in an Aug. 2 post announcing the coming Windows Pseudo Console. The Windows Pseudo Console API is aiming to remove those obstacles.
"Our goals here are to eradicate an entire class of issues and limitations for developers of Console and server apps, and to make developing code for the Windows Command Line infrastructure more powerful, consistent, and fun," Turner wrote.
Turner has been writing a series of posts about the Windows command line. His Windows Pseudo Console announcement recounted how terminal communications have evolved over the years. They've shifted from dumb terminals where people typed input using typewriter-like devices to PCs with screens and graphical displays. The pseudo console was added in *NIX operating systems as solution to teletype machines getting scrapped.
Microsoft's new Windows Pseudo Console aims to make the current ConHost in Windows "a true Console Host," Turner indicated. Microsoft expects to ship the new Windows Pseudo Console "in the next major release of Windows 10 (due sometime in fall/winter 2018)," he added. It's presently available for testing in the latest Windows 10 Insider Preview SDK.
Microsoft has already shifted some of its tools to use the new ConPTY API. The console team at Microsoft has collaborated with internal Microsoft teams on integration efforts, such as the teams developing Windows Subsystem for Linux, Windows Containers, Visual Studio and VSCode, along with "third-party" (non-Microsoft) developers.
Developers of command-line applications won't have to do much as the new "ConHost will do all the work for you," Turner indicated. They also can continue to use the old Console API if they want. However, Microsoft is encouraging developers to use the new ConPTY API if they are building new Windows command-line applications.
Turner indicated that the Windows Pseudo Console in Windows 10 will fix problems currently associated with connecting command-line applications in Windows. It will support "all Command-Line and/or GUI applications that communicate with Command-Line applications," he added. It'll also provide backward compatibility for existing command-line apps, he suggested. Command-line apps will "speak text/VT externally, without requiring any changes."
"Using the new ConPTY infrastructure, third party Consoles can now communicate directly with modern and traditional Command-Line applications, and speak text/VT with all of them," Turner noted.
Despite the historical baggage associated with it, Turner described Microsoft's switch to the ConPTY API as "perhaps one of the most fundamental, and liberating, changes that's happened to the Windows Command-Line in several years … if not decades!"
About the Author
Kurt Mackie is senior news producer for 1105 Media's Converge360 group.