Merge pull request #3284 from puffnfresh/wsl

Disable use-sqlite-wal under WSL
This commit is contained in:
Eelco Dolstra 2019-12-23 00:44:29 +01:00 committed by GitHub
commit aaf57c983d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -117,6 +117,15 @@ void Settings::requireExperimentalFeature(const std::string & name)
throw Error("experimental Nix feature '%s' is disabled", name);
}
bool Settings::isWSL1()
{
struct utsname utsbuf;
uname(&utsbuf);
// WSL1 uses -Microsoft suffix
// WSL2 uses -microsoft-standard suffix
return hasSuffix(utsbuf.release, "-Microsoft");
}
const string nixVersion = PACKAGE_VERSION;
template<> void BaseSetting<SandboxMode>::set(const std::string & str)

View File

@ -34,6 +34,8 @@ class Settings : public Config {
StringSet getDefaultSystemFeatures();
bool isWSL1();
public:
Settings();
@ -130,7 +132,7 @@ public:
Setting<bool> fsyncMetadata{this, true, "fsync-metadata",
"Whether SQLite should use fsync()."};
Setting<bool> useSQLiteWAL{this, true, "use-sqlite-wal",
Setting<bool> useSQLiteWAL{this, !isWSL1(), "use-sqlite-wal",
"Whether SQLite should use WAL mode."};
Setting<bool> syncBeforeRegistering{this, false, "sync-before-registering",