diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 620810d722..00393d6e8f 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -12,7 +12,7 @@ import { PersistentState } from './persistent_state'; import { fetchRelease, download } from './net'; import { activateTaskProvider } from './tasks'; import { setContextValue } from './util'; -import { exec } from 'child_process'; +import { exec, spawnSync } from 'child_process'; let ctx: Ctx | undefined; @@ -297,7 +297,7 @@ async function getServer(config: Config, state: PersistentState): Promise true, () => false); @@ -365,6 +368,13 @@ async function isNixOs(): Promise { } } +function isMusl(): boolean { + // We can detect Alpine by checking `/etc/os-release` but not Void Linux musl. + // Instead, we run `ldd` since it advertises the libc which it belongs to. + const res = spawnSync("ldd", ["--version"]); + return res.stderr != null && res.stderr.indexOf("musl libc") >= 0; +} + async function downloadWithRetryDialog(state: PersistentState, downloadFunc: () => Promise): Promise { while (true) { try {