From ee734668308df4549eb2ddbd7fed7911dc3a7ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 21 Dec 2020 19:18:50 +0200 Subject: 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. --- editors/code/src/main.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 191960960..4eaaed62b 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -340,7 +340,7 @@ async function getServer(config: Config, state: PersistentState): Promise true).catch(_ => false)) { + if (await isNixOs()) { await patchelf(dest); } @@ -348,6 +348,15 @@ async function getServer(config: Config, state: PersistentState): Promise { + try { + const contents = await fs.readFile("/etc/os-release"); + return contents.indexOf("ID=nixos") !== -1; + } catch (e) { + return false; + } +} + async function downloadWithRetryDialog(state: PersistentState, downloadFunc: () => Promise): Promise { while (true) { try { -- cgit v1.2.3