From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 90020385C422; Wed, 14 Feb 2024 14:30:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90020385C422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707921002; bh=EfYUQtN3yy8uZ46rhXT32nEg2Gq9wSo6jxvPRBhJ+F0=; h=From:To:Subject:Date:From; b=hPU7bgdYDibSCxaP7znFxr79pSKxfyp+H2xNEDys7SZ3zP9l8t5EIlGTRxhyqNVNR owFKVXt535tmnNdBii3Sf31oJnXgjMaL7qUaWgMks+mslP5EO5vr0+mib8379bFRxw 6K4keXABXWyR91/iV4tEcQH7fF4j+BGl1RobJQRY= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Make GNU screen and tmux work in ConEmu cygwin-connector. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 2a2a6486a089b90d05b258bd853d136f00cb7c69 X-Git-Newrev: 054f4801e67d70436c44563a5144e8b84596e553 Message-Id: <20240214143002.90020385C422@sourceware.org> Date: Wed, 14 Feb 2024 14:30:02 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D054f4801e67= d70436c44563a5144e8b84596e553 commit 054f4801e67d70436c44563a5144e8b84596e553 Author: Takashi Yano Date: Wed Feb 14 23:10:04 2024 +0900 Cygwin: pty: Make GNU screen and tmux work in ConEmu cygwin-connector. =20 Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from= other terminals.") Signed-off-by: Takashi Yano Diff: --- winsup/cygwin/fhandler/pty.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc index d31d30b1f..e52590c9d 100644 --- a/winsup/cygwin/fhandler/pty.cc +++ b/winsup/cygwin/fhandler/pty.cc @@ -970,7 +970,7 @@ fhandler_pty_slave::open (int flags, mode_t) set_output_handle (to_master_local); =20 if (_major (myself->ctty) =3D=3D DEV_CONS_MAJOR - && !(!pinfo (myself->ppid) && getenv ("ConEmuPID"))) + && !(!pinfo (myself->ppid) && GetModuleHandle ("ConEmuHk64.dll"))) /* This process is supposed to be a master process which is running on console. Invisible console will be created in primary slave process to prevent overriding code page @@ -1049,6 +1049,8 @@ fhandler_pty_slave::close () fhandler_pty_common::close (); if (!ForceCloseHandle (output_mutex)) termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex); + if (!get_ttyp ()->invisible_console_pid && myself->ctty =3D=3D CTTY_RELE= ASED) + FreeConsole(); if (get_ttyp ()->invisible_console_pid && !pinfo (get_ttyp ()->invisible_console_pid)) get_ttyp ()->invisible_console_pid =3D 0;