New implementation of pseudo console support (experimental)
Takashi Yano
takashi.yano@nifty.ne.jp
Mon Aug 3 02:05:04 GMT 2020
Hi Corinna,
On Sun, 2 Aug 2020 14:01:04 +0200
Corinna Vinschen wrote:
> On Jul 24 20:22, Takashi Yano via Cygwin-developers wrote:
> > On Fri, 24 Jul 2020 14:38:42 +0900
> > Takashi Yano via Cygwin-developers <cygwin-developers@cygwin.com> wrote:
> > > On Thu, 23 Jul 2020 09:33:28 +0900
> > > Takashi Yano via Cygwin-developers <cygwin-developers@cygwin.com> wrote:
> > > > On Wed, 22 Jul 2020 17:45:41 +0900
> > > > Takashi Yano via Cygwin-developers <cygwin-developers@cygwin.com> wrote:
> > > > > > [...]
> > > > > Attached is the patch in git format-patch format.
> > > > > All the codes specific to the current implementation are removed.
> > > > >
> > > > > Despite the utmost care, the changes are relatively large, so some
> > > > > degradation may exist.
> > > > >
> > > > > I will appreciate if you could test.
> > > >
> > > > There were still unused code. Please try attached patch instead.
> > >
> > > Changes:
> > > * Do not activate pseudo console if it is already activated for
> > > another process on same pty.
> >
> > Changes:
> > * Fix a bug in the latest change.
> >
> > --
> > Takashi Yano <takashi.yano@nifty.ne.jp>
>
> While hacking on the posix_spawn thingy, I noticed this hunk of yours:
>
> @@ -897,6 +910,11 @@ child_info_spawn::worker (const char *prog_arg, const char
> *const *argv,
> && WaitForSingleObject (pi.hProcess, 0) == WAIT_TIMEOUT)
> wait_for_myself ();
> }
> + if (enable_pcon)
> + {
> + WaitForSingleObject (pi.hProcess, INFINITE);
> + ptys_primary->close_pseudoconsole ();
> + }
> myself.exit (EXITCODE_NOSET);
> break;
> case _P_WAIT:
>
> Wait... what? So the exec'ing process hangs infinitely if the exec'ed
> process runs infinitely? Doesn't that have weird side effects by any
> chance?
This is needed to close pseudo console when the native console app
is terminated.
exec() call does not return on success. So the caller is not affected.
If mode == _P_OVERLAY, the process is not seen from cygwin, though,
it is seen from windows task manager. I have not noticed any serious
side effects so far.
BTW, I have noticed the current code cause handle leak if mode !=
_P_OVERLAY due to lack of chance to close pseudo console.
I will submit a new patch.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Cygwin-developers
mailing list