mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Use /etc/os-release to check for NixOS
The motivation in #5641 isn't too strong, but /etc/os-release exists on pretty much every Linux distro, while /etc/nixos sounds like an implementation detail.
This commit is contained in:
parent
c8a73fe655
commit
ee73466830
1 changed files with 10 additions and 1 deletions
|
@ -340,7 +340,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
|
||||||
});
|
});
|
||||||
|
|
||||||
// Patching executable if that's NixOS.
|
// Patching executable if that's NixOS.
|
||||||
if (await fs.stat("/etc/nixos").then(_ => true).catch(_ => false)) {
|
if (await isNixOs()) {
|
||||||
await patchelf(dest);
|
await patchelf(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,6 +348,15 @@ async function getServer(config: Config, state: PersistentState): Promise<string
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function isNixOs(): Promise<boolean> {
|
||||||
|
try {
|
||||||
|
const contents = await fs.readFile("/etc/os-release");
|
||||||
|
return contents.indexOf("ID=nixos") !== -1;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function downloadWithRetryDialog<T>(state: PersistentState, downloadFunc: () => Promise<T>): Promise<T> {
|
async function downloadWithRetryDialog<T>(state: PersistentState, downloadFunc: () => Promise<T>): Promise<T> {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue