[PATCH 0/2] Return appropriate handle by _get_osfhandle() and GetStdHandle().

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Mar 23 13:32:39 GMT 2021


On Mar 23 21:52, Takashi Yano via Cygwin-patches wrote:
> On Tue, 23 Mar 2021 21:42:06 +0900
> Takashi Yano wrote:
> > On Tue, 23 Mar 2021 21:32:12 +0900
> > Takashi Yano wrote:
> > > I try to check run.exe behaviour and noticed that
> > > run cmd.exe
> > > and
> > > run cat.exe
> > > does not work with cygwin 3.0.7 and 3.2.0 (TEST) while these
> > > work in 3.1.7.
> > 
> > In obove cases, cmd.exe and cat.exe is running in *hidden* console,
> > therefore nothing is shown. Right?
> 
> In what situation are
>   psi->cb = sizeof (STARTUPINFO);
>   psi->hStdInput  = GetStdHandle (STD_INPUT_HANDLE);
>   psi->hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE);
>   psi->hStdError  = GetStdHandle (STD_ERROR_HANDLE);
> these handles used?

Hmm, trying to make sense from the code, I'd say, these handles are used
by default, unless run.exe is already attached to a console.  In  the
latter case, it calls CreateFile( "CONIN$") etc. to attach the new
process to that console.

As Jon wrote a few minutes ago, I'm not sure what this gymnastics are
good for either...


Corinna


More information about the Cygwin-patches mailing list