From 5101bdeb9f2d2d0a362619edde3da8c1b9cd7101 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 16 Aug 2019 18:48:30 -0700 Subject: [PATCH] Remove the WSL warning This warning is annoying and there is no way to disable it. Ping #5661. Ping #5298. Closes #6038 --- src/common.cpp | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index 54856d3af..a775314ce 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -31,11 +32,6 @@ #include #endif -#ifdef __linux__ -// Includes for WSL detection -#include -#endif - #ifdef __FreeBSD__ #include #elif __APPLE__ @@ -157,29 +153,10 @@ bool is_windows_subsystem_for_linux() { #elif not defined(__linux__) return false; #else - // We are purposely not using std::call_once as it may invoke locking, which is an unnecessary - // overhead since there's no actual race condition here - even if multiple threads call this - // routine simultaneously the first time around, we just end up needlessly querying uname(2) one - // more time. - static bool wsl_state = []() { - utsname info; + utsname info{}; uname(&info); - - // Sample utsname.release under WSL: 4.4.0-17763-Microsoft - if (std::strstr(info.release, "Microsoft") != nullptr) { - const char *dash = std::strchr(info.release, '-'); - if (dash == nullptr || strtod(dash + 1, nullptr) < 17763) { - debug(1, - "This version of WSL is not supported and fish will probably not work " - "correctly!\n" - "Please upgrade to Windows 10 1809 (17763) or higher to use fish!"); - } - - return true; - } else { - return false; - } + return std::strstr(info.release, "Microsoft") != nullptr; }(); // Subsequent calls to this function may take place after fork() and before exec() in