mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-16 06:54:03 +00:00
Change WSL version check to a hard error, but include a bypass
Instead of warning (debug level 1), we now emit an error (debug level 0) if a known bad version of WSL is detected. However, `FISH_NO_WSL_CHECK` can now be defined to skip both the check and the startup message.
This commit is contained in:
parent
44022e65c2
commit
af4b54e635
1 changed files with 19 additions and 6 deletions
|
@ -166,14 +166,26 @@ bool is_windows_subsystem_for_linux() {
|
||||||
utsname info;
|
utsname info;
|
||||||
uname(&info);
|
uname(&info);
|
||||||
|
|
||||||
// Sample utsname.release under WSL: 4.4.0-17763-Microsoft
|
// Sample utsname.release under WSL, testing for something like `4.4.0-17763-Microsoft`
|
||||||
if (std::strstr(info.release, "Microsoft") != nullptr) {
|
if (std::strstr(info.release, "Microsoft") != nullptr) {
|
||||||
const char *dash = std::strchr(info.release, '-');
|
const char *dash = std::strchr(info.release, '-');
|
||||||
if (dash == nullptr || strtod(dash + 1, nullptr) < 17763) {
|
if (dash == nullptr || strtod(dash + 1, nullptr) < 17763) {
|
||||||
debug(1,
|
// #5298, #5661: There are acknowledged, published, and (later) fixed issues with
|
||||||
"This version of WSL is not supported and fish will probably not work "
|
// job control under early WSL releases that prevent fish from running correctly,
|
||||||
"correctly!\n"
|
// with unexpected failures when piping. Fish 3.0 nightly builds worked around this
|
||||||
"Please upgrade to Windows 10 1809 (17763) or higher to use fish!");
|
// issue with some needlessly complicated code that was later stripped from the
|
||||||
|
// fish 3.0 release, so we just bail. Note that fish 2.0 was also broken, but we
|
||||||
|
// just didn't warn about it.
|
||||||
|
|
||||||
|
// #6038 & 5101bde: It's been requested that there be some sort of way to disable
|
||||||
|
// this check: if the environment variable FISH_NO_WSL_CHECK is present, this test
|
||||||
|
// is bypassed. We intentionally do not include this in the error message because
|
||||||
|
// it'll only allow fish to run but not to actually work. Here be dragons!
|
||||||
|
if (getenv("FISH_NO_WSL_CHECK") == nullptr) {
|
||||||
|
debug(0,
|
||||||
|
"This version of WSL has known bugs that prevent fish from working."
|
||||||
|
"Please upgrade to Windows 10 1809 (17763) or higher to use fish!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -453,7 +465,8 @@ static char *wcs2str_internal(const wchar_t *in, char *out) {
|
||||||
} else {
|
} else {
|
||||||
size_t len = std::wcrtomb(&out[out_pos], in[in_pos], &state);
|
size_t len = std::wcrtomb(&out[out_pos], in[in_pos], &state);
|
||||||
if (len == (size_t)-1) {
|
if (len == (size_t)-1) {
|
||||||
FLOGF(char_encoding, L"Wide character U+%4X has no narrow representation", in[in_pos]);
|
FLOGF(char_encoding, L"Wide character U+%4X has no narrow representation",
|
||||||
|
in[in_pos]);
|
||||||
std::memset(&state, 0, sizeof(state));
|
std::memset(&state, 0, sizeof(state));
|
||||||
} else {
|
} else {
|
||||||
out_pos += len;
|
out_pos += len;
|
||||||
|
|
Loading…
Reference in a new issue