If a process is running under control of winpty, the output of the process is decorated with ESC sequences to control a terminal to print the process output nicely. In some environments however, the client showing the output to the user is not a full terminal emulation, the Eclipse CDT debug console view in example, and the ESC sequences are printed as output additional to the real process output. This commit is adding an API function to switch into a mode where winpty is not decorating the process output with ESC sequences. The console mode is designated to pass on the process output to the client as is.
Added new agent message "GetProcessId" and a API "winpty_get_process_id"
to allow access to the process id of the started process. The process id
is needed to integrate "winpty" with Eclipse CDT to launch native Windows
console applications inside the Eclipse UI.
* When building with MSVC, there is no snprintf function, but there are
_snprintf, vsnprintf, and _vsnprintf functions (as well as many
variations on these). The MSVC _snprintf is not the same as C99's
snprintf, and in particular, it does not guarantee that the buffer is
NUL-terminated, whereas C99 does guarantee this. I want the C99
behavior, so add a c99_[v]snprintf functions in shared/c99_snprintf.h
that provide C99 behavior.
* Details:
http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010