[PATCH v2] Cygwin: pty: Revise code waiting for forwarding again.

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jan 27 09:28:00 GMT 2020


On Jan 27 13:22, Takashi Yano wrote:
> On Mon, 27 Jan 2020 11:38:22 +0900
> Takashi Yano wrote:
> > On Sun, 26 Jan 2020 22:33:19 +0900
> > Takashi Yano wrote:
> > > On Sat, 25 Jan 2020 20:38:37 +0900
> > > Takashi Yano wrote:
> > > > On Fri, 24 Jan 2020 12:07:30 +0100
> > > > Corinna Vinschen wrote:
> > > > > Too bad.  It's pretty strange that CreatePseudoConsole returns a
> > > > > valid HPCON but then isn't ready to take input immediately.
> > > > > 
> > > > > > I do not come up with other implementation so far.
> > > > > > 
> > > > > > Let me consider a while.
> > > > > 
> > > > > I wonder how others solve this problem.  I see that the native OpenSSH
> > > > > is using Sleeps, too, in their start_with_pty() function, calling
> > > > > AttachConsole in a loop, but I'm not sure if these are related to pseudo
> > > > > console usage.  The commit message don't explain anything there :(
> > > > 
> > > > The essence of the difficulty is that we have to support both cygwin
> > > > programs and native console apps. If we consider only of native console
> > > > apps, any time we can use pseudo console. However, pseudo console is
> > > > not transparent at all, so it cannot be used for cygwin programs.
> > > > 
> > > > Therefore, current cygwin is switching handles to be used between
> > > > named-pipe and pseudo console.
> > > > 
> > > > However, because pseudo console has relatively long latency, if pipe
> > > > is switched just after writing to pseudo console, the forwarding
> > > > does not get in time. So the "wait" is needed before switching.
> > > > 
> > > > I had tried WriteFile(), ReadFile() and DeviceIoControl() for
> > > > HANDLE hConDrvReference, however, all atempts of them failed.
> > > 
> > > After much struggle, I finally found a solution.
> > > Please look at v3 patch.
> > 
> > v3 patch does not seem to work as expected in Win10 1809.
> > I will submit v4 patch.
> 
> Sorry for again and again.

This is tricky stuff.  No worries at all.

> I think v5 is more fundamental fix than v4.

I didn't see a v5 yet.  It's still in the works, I take it?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20200127/ae50bd36/attachment.sig>


More information about the Cygwin-patches mailing list