Re: [PATCH v5] Cygwin: console: Fix undesired mode change at exit of non-cygwin apps

Takashi Yano <[email protected]> Sat, 18 Jul 2026 22:27:34 +0900
Newsgroups gmane.os.cygwin.patches
Message-ID <[email protected]>
Sorry, I forgot to add cleanup() on CreateProcess() failure.

On Sat, 18 Jul 2026 22:12:14 +0900
Takashi Yano wrote:
> diff --git a/winsup/cygwin/fhandler/termios.cc b/winsup/cygwin/fhandler/termios.cc
> index ee576a0a8..f8269cc4f 100644
> --- a/winsup/cygwin/fhandler/termios.cc
> +++ b/winsup/cygwin/fhandler/termios.cc
> @@ -826,6 +826,17 @@ fhandler_termios::spawn_worker::setup (bool iscygwin, HANDLE h_stdin,
>      }
>  }
>  
> +void
> +fhandler_termios::spawn_worker::notify_spawned (bool success)
> +{
> +  if (cygheap->ctty && cygheap->ctty->get_major () == DEV_CONS_MAJOR
> +      && cygheap->ctty->tc ()->getpgid () == myself->pgid)
> +    {
> +      fhandler_console *cons = (fhandler_console *) cygheap->ctty;
> +      cons->set_non_cygwin_app_setup_ongoing (false);
> +    }

+  if (!success && need_cleanup ())
+    cleanup ();

> +}
> +
>  void
>  fhandler_termios::spawn_worker::cleanup ()
>  {

-- 
Takashi Yano <[email protected]>