mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 17:07:44 +00:00
Remove the WSL warning
This warning is annoying and there is no way to disable it. Ping #5661. Ping #5298. Closes #6038
This commit is contained in:
parent
f137f24d75
commit
5101bdeb9f
1 changed files with 3 additions and 26 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <wctype.h>
|
||||
|
@ -31,11 +32,6 @@
|
|||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
// Includes for WSL detection
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/sysctl.h>
|
||||
#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
|
||||
|
|
Loading…
Reference in a new issue