Windows: issue a warning for PWSH/cmd term only in W10

Do not issue the warning over PowerShell or cmd legacy terminal emulators
in Windows 11. In Window the check doesn't work, because the process
tree is different - the Windows Terminal doesn't have its own process
and it is uv.exe->powershell.exe->exporer.exe.

This improves commit bb2a72f67f.
This commit is contained in:
Martin Pulec
2024-02-28 11:26:15 +01:00
parent d74922e443
commit 502fb0c554
3 changed files with 41 additions and 3 deletions

View File

@@ -462,10 +462,11 @@ struct init_data *common_preinit(int argc, char *argv[])
}
// warn in W10 "legacy" terminal emulators
if ((win_has_ancestor_process("powershell.exe") ||
if (getenv("TERM") == nullptr &&
get_windows_build() < BUILD_WINDOWS_11_OR_LATER &&
(win_has_ancestor_process("powershell.exe") ||
win_has_ancestor_process("cmd.exe")) &&
!win_has_ancestor_process("WindowsTerminal.exe") &&
getenv("TERM") == nullptr) {
!win_has_ancestor_process("WindowsTerminal.exe")) {
MSG(WARNING, "Running inside PS/cmd terminal is not recommended "
"because scrolling the output freezes the process, "
"consider using Windows Terminal instead!\n");