[PATCH] Cygwin: pty: Disable clear screen for ssh sessions with -t option.

Michael Haubenwallner michael.haubenwallner@ssi-schaefer.com
Tue Oct 22 07:20:00 GMT 2019


Hi Takashi,

On 10/18/19 1:37 PM, Takashi Yano wrote:
> ---
>  winsup/cygwin/fhandler_tty.cc | 21 ++++++++++++++++++++-
>  winsup/cygwin/tty.cc          |  1 +
>  winsup/cygwin/tty.h           |  1 +
>  3 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> index da6119dfb..163f93f35 100644
> --- a/winsup/cygwin/fhandler_tty.cc
> +++ b/winsup/cygwin/fhandler_tty.cc
> @@ -1305,6 +1305,20 @@ fhandler_pty_slave::write (const void *ptr, size_t len)
>    if (bg <= bg_eof)
>      return (ssize_t) bg;
>  
> +  if (get_ttyp ()->need_clear_screen_on_write)
> +    {
> +      const char *term = getenv ("TERM");
> +      if (term && strcmp (term, "dumb") && !strstr (term, "emacs") &&
> +	  wcsstr (myself->progname, L"\\usr\\sbin\\sshd.exe"))

Again, my real problem does not utilize ssh at all, but is some python script
using multiple pty.openpty() to spawn commands inside, to allow for herding
all the subprocesses started by the commands (Ctrl-C or similar).

The ssh -t is just the sample showing a similar effect.

Unfortunately, I'm not deep enough into that python script to quickly provide
a test case with pty.openpty() combined with all the tty settings used there.

I've started to extract the important bits, but that may take a while.  OTOH,
this is an open source project if you like to try yourself: prefix.gentoo.org

Thanks!
/haubi/



More information about the Cygwin-patches mailing list