1+ import { spawnSync } from "node:child_process" ;
12import isWSL from "is-wsl" ;
23import { workspace } from "vscode" ;
34
5+ /**
6+ * Whether the current platform uses musl
7+ */
8+ export const isMusl = ( ( ) => {
9+ // If not on Linux, or on WSL we can't be using musl
10+ if ( process . platform !== "linux" || isWSL ) {
11+ return false ;
12+ }
13+
14+ try {
15+ const output = spawnSync ( "ldd" , [ "--version" ] , { encoding : "utf8" } ) ;
16+ return output . stdout . includes ( "musl" ) ;
17+ } catch {
18+ return false ;
19+ }
20+ } ) ( ) ;
21+
422/**
523 * Platform identifier
624 *
@@ -14,11 +32,7 @@ import { workspace } from "vscode";
1432export const platformIdentifier = ( ( ) => {
1533 let flavor = "" ;
1634
17- // On Linux, we always use the `musl` flavor because it has the advantage of
18- // having been built statically. This is meant to improve the compatibility
19- // with various systems such as NixOS, which handle dynamically linked
20- // binaries differently.
21- if ( process . platform === "linux" && ! isWSL ) {
35+ if ( isMusl ) {
2236 flavor = "-musl" ;
2337 }
2438
@@ -44,7 +58,10 @@ export const platformSpecificBinaryName = (() => {
4458 * This constant contains the name of Biome CLI GitHub release asset for the
4559 * current platform.
4660 *
47- * @example "biome-linux-x64"
61+ * On Linux, we always return the musl flavor, as it's the most compatible
62+ * since its statically linked.
63+ *
64+ * @example "biome-linux-x64-musl"
4865 * @example "biome-darwin-x64"
4966 * @example "biome-win32-x64.exe"
5067 */
0 commit comments