A Windows software package providing an interface similar to a Unix pty-master for communicating with Windows console programs.
Go to file
Ryan Prichard 6a29852ace Stop sending trailing whitespace in Terminal::sendLine.
* The intent of having the length variable was to avoid sending trailing
   whitespace for each line, but the previous code never read the variable.
   Instead, every line it sent was the width of the terminal window.

 * There was a bug where running console.exe inside a TERM=cygwin terminal
   resulted in excessive line feeds.  This change mitigates that bug, but
   doesn't fix it.  The problem is that the agent assumes that after it
   writes to the last column of a line, the cursor is still on the same
   line, but this isn't true for the TERM=cygwin terminal.
2012-03-28 03:10:37 -07:00
agent Stop sending trailing whitespace in Terminal::sendLine. 2012-03-28 03:10:37 -07:00
build Replace build/.placeholder with build/.gitkeep. 2012-03-23 03:48:40 -07:00
include Rename pconsole to winpty. 2012-03-25 02:29:37 -07:00
libwinpty Rename pconsole to winpty. 2012-03-25 02:29:37 -07:00
Misc In the UNIX adapter, start the child process specified on the command line. 2012-03-24 16:48:41 -07:00
Shared Rename pconsole to winpty. 2012-03-25 02:29:37 -07:00
unix-adapter Rename pconsole to winpty. 2012-03-25 02:29:37 -07:00
.gitattributes Create a configure script. 2012-03-25 15:55:03 -07:00
.gitignore Remove old Qt files. 2012-03-24 18:02:28 -07:00
config.mk Create a configure script. 2012-03-25 15:55:03 -07:00
configure Mark configure as executable and exit if uname -s isn't recognized. 2012-03-25 19:24:39 -07:00
Makefile Rename pconsole to winpty. 2012-03-25 02:29:37 -07:00
Notes.txt Stop sending trailing whitespace in Terminal::sendLine. 2012-03-28 03:10:37 -07:00
README.rst Add a readme. 2012-03-25 19:30:47 -07:00

======
winpty
======

winpty is a Windows software package that emulates a Unix pty-master interface
to Windows console programs.  It consists of a library and a tool for Cygwin
and MSYS for running a Windows console program under a Cygwin/MSYS pty, such as
that used by ``mintty`` or ``sshd``.

Prerequisites
=============

You need the following to build winpty:

* A Cygwin or MSYS installation
* GNU make
* A MinGW 32-bit g++ toolchain, v4 or later, to build ``winpty.dll`` and
  ``winpty-agent.exe``
* A g++ toolchain targeting Cygwin or MSYS, v3 or later, to build console.exe

MinGW appears to be split into two distributions -- MinGW (32-bit only) and
MinGW-w64 (which compiles both 32-bit and 64-bit binaries).  Either one is
acceptable, but the compiler must be v4 or later.

Cygwin packages
---------------

The default g++ compiler for Cygwin targets Cygwin itself, but Cygwin also
packages MinGW compilers from both the MinGW and MinGW-w64 projects.  As of
this writing, the necessary packages are:

* Either ``mingw-gcc-g++`` or ``mingw64-i686-gcc-g++`` (but not
  ``mingw64-x86_64-gcc-g++``)
* ``gcc4-g++``

Build
=====

In the project directory, run ``./configure``, then ``make``.

This will produce three binaries:

* ``build/winpty.dll``
* ``build/winpty-agent.exe``
* ``build/console.exe``

Using the Unix adapter
======================

To run a Windows console program in ``mintty`` or Cygwin ``sshd``, prepend 
``console.exe`` to the command-line::

    $ build/console.exe c:/Python27/python.exe
    Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 10 + 20
    30
    >>> exit()
    $

How it works
============

The emulation starts a ``winpty-agent.exe`` process with a console window on a
hidden desktop.  It polls the console output for changes and converts them
to a stream of VT100 escape codes.  It converts input escape codes into console
input records.