On Mon Jun 12 15:54:02 2023 +0000, Jacek Caban wrote:
Maybe we can revisit inheriting console by GUI applications. Regardless of Unix console handling, it seems that GUI process should not be attached to parent's console. How about the attached [patch](/uploads/49af7084b2f9f92c244e175b883e6b03/patch.diff)? While I think that taking shell-no-windows into account in `AttachConsole`, like MR2986, makes sense on its own, I think that we should generally treat proper Unix console just like proper Windows consoles when possible.
I didn't go that far as it seems to me that some apps use the std handles for logging and debug output (when the handles are present) (I discussed this offline with @gofman recently and it seems he had some concerns about this)
If we want to go the way of erasing the console for GUI processes as your patch proposes, I think we'd need more tests for checking inheritedhandles to parent's console without connecting console handle (is the console object inherited ? and are the std handles still usable? when passed in process info) (what your patch does is likely inherit console's object in server, but doesn't set it as current console in kernelbase ; so more tests required) (iow shall we close incoming ->ConsoleHandle? and/or std handles). I'll write some more tests for that and post the results in this MR.
I fully agree for considering unix console as genuine consoles for CUI programs. For GUI, is we erase the console the question is closed. If we don't, that's more an opened question.