public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: pty: Skip term_has_pcon_cap() if pseudo console is disabled.
@ 2020-12-14  8:25 Takashi Yano
  2020-12-14 10:04 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2020-12-14  8:25 UTC (permalink / raw)
  To: cygwin-patches

- This patch skips unnecessary term_has_pcon_cap() call if pseudo
  console is disabled.
---
 winsup/cygwin/fhandler_tty.cc | 2 --
 winsup/cygwin/spawn.cc        | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index a6dc8e93b..845e51184 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -2459,8 +2459,6 @@ fhandler_pty_slave::setup_pseudoconsole (STARTUPINFOEXW *si, bool nopcon)
   if (get_ttyp ()->pcon_pid && get_ttyp ()->pcon_pid != myself->pid
       && !!pinfo (get_ttyp ()->pcon_pid))
     return false;
-  if (disable_pcon)
-    return false;
   /* If the legacy console mode is enabled, pseudo console seems
      not to work as expected. To determine console mode, registry
      key ForceV2 in HKEY_CURRENT_USER\Console is checked. */
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 83b216f52..5057af932 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -656,7 +656,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
       if (!iscygwin () && ptys_primary && is_console_app (runpath))
 	{
 	  bool nopcon = mode != _P_OVERLAY && mode != _P_WAIT;
-	  if (!ptys_primary->term_has_pcon_cap (envblock))
+	  if (disable_pcon || !ptys_primary->term_has_pcon_cap (envblock))
 	    nopcon = true;
 	  if (ptys_primary->setup_pseudoconsole (&si_pcon, nopcon))
 	    {
-- 
2.29.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Cygwin: pty: Skip term_has_pcon_cap() if pseudo console is disabled.
  2020-12-14  8:25 [PATCH] Cygwin: pty: Skip term_has_pcon_cap() if pseudo console is disabled Takashi Yano
@ 2020-12-14 10:04 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2020-12-14 10:04 UTC (permalink / raw)
  To: cygwin-patches

On Dec 14 17:25, Takashi Yano via Cygwin-patches wrote:
> - This patch skips unnecessary term_has_pcon_cap() call if pseudo
>   console is disabled.
> ---
>  winsup/cygwin/fhandler_tty.cc | 2 --
>  winsup/cygwin/spawn.cc        | 2 +-
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
> index a6dc8e93b..845e51184 100644
> --- a/winsup/cygwin/fhandler_tty.cc
> +++ b/winsup/cygwin/fhandler_tty.cc
> @@ -2459,8 +2459,6 @@ fhandler_pty_slave::setup_pseudoconsole (STARTUPINFOEXW *si, bool nopcon)
>    if (get_ttyp ()->pcon_pid && get_ttyp ()->pcon_pid != myself->pid
>        && !!pinfo (get_ttyp ()->pcon_pid))
>      return false;
> -  if (disable_pcon)
> -    return false;
>    /* If the legacy console mode is enabled, pseudo console seems
>       not to work as expected. To determine console mode, registry
>       key ForceV2 in HKEY_CURRENT_USER\Console is checked. */
> diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
> index 83b216f52..5057af932 100644
> --- a/winsup/cygwin/spawn.cc
> +++ b/winsup/cygwin/spawn.cc
> @@ -656,7 +656,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
>        if (!iscygwin () && ptys_primary && is_console_app (runpath))
>  	{
>  	  bool nopcon = mode != _P_OVERLAY && mode != _P_WAIT;
> -	  if (!ptys_primary->term_has_pcon_cap (envblock))
> +	  if (disable_pcon || !ptys_primary->term_has_pcon_cap (envblock))
>  	    nopcon = true;
>  	  if (ptys_primary->setup_pseudoconsole (&si_pcon, nopcon))
>  	    {
> -- 
> 2.29.2

All three patches pushed.

Thanks,
Corinna

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-14 10:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14  8:25 [PATCH] Cygwin: pty: Skip term_has_pcon_cap() if pseudo console is disabled Takashi Yano
2020-12-14 10:04 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).