This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.
I think v5 is more fundamental fix than v4.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]