On 2021-Mar-04, Andres Freund wrote: > > > There does seem to be isatty(), so we could improve the case of > > > pg_ctl/postgres run interactively without breaking a sweat. And there is > > > fstat() too, so if stderr in a service is something distinguishable... > > > > We seem to have used that at some point, but commit > > a967613911f7ef7b6387b9e8718f0ab8f0c4d9c8 got rid of it... > > Hm. The bug #13592 referenced in that commit appears to be about > something else. Looks to be #13594 > https://postgr.es/m/20150828104658.2089.83265%40wrigleys.postgresql.org
Yeah, that's a typo in the commit message. > > But maybe apply it in a combination. > > Yea, that's what I was thinking. That makes sense. At the time we were not thinking (*I* was not thinking, for sure) that you could have a not-a-service process that runs inside a service. The fixed bug was in the same direction that you want to fix now, just differently: the bare "isatty" test was considering too many things as under a service, and replaced it with the pgwin32_is_service which considers a different set of too many things as under a service. I agree with the idea that *both* tests have to pass in order to consider it as under a service. -- Álvaro Herrera 39°49'30"S 73°17'W "No hay hombre que no aspire a la plenitud, es decir, la suma de experiencias de que un hombre es capaz"