forked from lix-project/lix
Merge pull request #3284 from puffnfresh/wsl
Disable use-sqlite-wal under WSL
This commit is contained in:
commit
aaf57c983d
2 changed files with 12 additions and 1 deletions
|
@ -117,6 +117,15 @@ void Settings::requireExperimentalFeature(const std::string & name)
|
||||||
throw Error("experimental Nix feature '%s' is disabled", 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;
|
const string nixVersion = PACKAGE_VERSION;
|
||||||
|
|
||||||
template<> void BaseSetting<SandboxMode>::set(const std::string & str)
|
template<> void BaseSetting<SandboxMode>::set(const std::string & str)
|
||||||
|
|
|
@ -34,6 +34,8 @@ class Settings : public Config {
|
||||||
|
|
||||||
StringSet getDefaultSystemFeatures();
|
StringSet getDefaultSystemFeatures();
|
||||||
|
|
||||||
|
bool isWSL1();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Settings();
|
Settings();
|
||||||
|
@ -130,7 +132,7 @@ public:
|
||||||
Setting<bool> fsyncMetadata{this, true, "fsync-metadata",
|
Setting<bool> fsyncMetadata{this, true, "fsync-metadata",
|
||||||
"Whether SQLite should use fsync()."};
|
"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."};
|
"Whether SQLite should use WAL mode."};
|
||||||
|
|
||||||
Setting<bool> syncBeforeRegistering{this, false, "sync-before-registering",
|
Setting<bool> syncBeforeRegistering{this, false, "sync-before-registering",
|
||||||
|
|
Loading…
Reference in a new issue