[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

if STREAM.isatty():

On Sat, Aug 31, 2019 at 8:58 AM Eryk Sun <eryksun at gmail.com> wrote:
> On 8/30/19, Chris Angelico <rosuav at gmail.com> wrote:
> > On Sat, Aug 31, 2019 at 7:42 AM Eryk Sun <eryksun at gmail.com> wrote:
> >
> >> In Windows 8+, a process attaches to a console by opening
> >> "\Device\ConDrv\Connect" as a connection to an instance of the console
> >> host process, conhost.exe. This handle is stored internally as
> >> "ConsoleHandle" (in its PEB->ProcessParameters). The console API uses
> >> this handle for functions that don't operate on a stream, such as
> >> GetConsoleTitle.
> >> [chomp more details]
> >
> > Huh. I kinda just assumed that, since cmd.exe was still running, the
> > console would continue to be in use. I guess technically it's a lot
> > more complicated than that, but still, to the average user, the
> > difference won't be visible.
> I was just clarifying the implementation details of what kind of
> reference is used to keep a console alive in Windows 8+. To me the
> details are useful to flesh out a picture of how things work, so that
> I know what to look for when they fail to work. For the average user
> and average use case, all that we need to know is that at least one
> process has to be attached to the console to keep it alive.

Yes, and I appreciate the info from the perspective of curiosity! Even
though it won't make a difference most of the time, it's still cool to