From 446fac2b0d642f7a06c0acd2dbf1504e8dc675b9 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 8 Jul 2024 16:38:33 +0200 Subject: [PATCH] Win 10 term warn: don't print if stdout isn't tty The terminal warning is neadlessly printed eg. in the GUI. --- src/host.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/host.cpp b/src/host.cpp index 3f165bc44..f77bb8404 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -44,10 +44,12 @@ #include "config_win32.h" #endif -#ifndef _WIN32 +#ifdef _WIN32 +#include +#else #include #include -#endif // defined _WIN32 +#endif // !defined _WIN32 #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 27 #include @@ -465,6 +467,7 @@ struct init_data *common_preinit(int argc, char *argv[]) // warn in W10 "legacy" terminal emulators if (getenv("TERM") == nullptr && + _isatty(fileno(stdout)) && get_windows_build() < BUILD_WINDOWS_11_OR_LATER && (win_has_ancestor_process("powershell.exe") || win_has_ancestor_process("cmd.exe")) &&