diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2019-08-27 21:04:02 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2019-08-29 14:47:40 +0300 |
commit | 169d65a5774acc76ce3f3feeedcbae7405aa9b57 (patch) | |
tree | 234f422b3511f90285c412cb01e49fb5a02fb250 /winsup/cygwin/strace.cc | |
parent | 398476acd2dca8d68044e1b6e68eb41a16086f79 (diff) |
Cygwin: pty: add pseudo console support.
- Support pseudo console in PTY. Pseudo console is a new feature
in Windows 10 1809, which provides console APIs on virtual
terminal. With this patch, native console applications can work
in PTYs such as mintty, ssh, gnu screen or tmux.
Diffstat (limited to 'winsup/cygwin/strace.cc')
-rw-r--r-- | winsup/cygwin/strace.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index 35f8a59ae..b1eb5f3e4 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -279,6 +279,30 @@ strace::vprntf (unsigned category, const char *func, const char *fmt, va_list ap CloseHandle (h); } } +#if 1 /* Experimental code */ + /* PTY with pseudo console cannot display data written to + STD_ERROR_HANDLE (output_handle) if the process is cygwin + process. output_handle works only in native console apps. + Therefore the data should be written to output_handle_cyg + as well. */ + fhandler_base *fh = ::cygheap->fdtab[2]; + if (fh && fh->get_major () == DEV_PTYS_MAJOR) + { + fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh; + if (ptys->getPseudoConsole ()) + { + HANDLE h_cyg = ptys->get_output_handle_cyg (); + if (buf[len-1] == '\n' && len < NT_MAX_PATH - 1) + { + buf[len-1] = '\r'; + buf[len] = '\n'; + len ++; + } + WriteFile (h_cyg, buf, len, &done, 0); + FlushFileBuffers (h_cyg); + } + } +#endif } #ifndef NOSTRACE |