Skip to content

Commit ae488d9

Browse files
authored
Fix Alpine Linux binary server (#1016)
1 parent c30fe32 commit ae488d9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
},
2727
"binaryServerDownloadUrl": {
2828
"linux": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-linux.zip",
29+
"alpine": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-alpine.zip",
2930
"osx-x86_64": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-osx-x86_64.zip",
3031
"osx-aarch_64": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-osx-aarch_64.zip",
3132
"win32": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-win32.zip"

Diff for: src/server/binary/binaryServerStarter.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,24 @@ function getBinaryEnvironment(): any {
206206
return process.env;
207207
}
208208

209+
/**
210+
* Returns the platform of the current operating system.
211+
* If the OS is Alpine Linux, it returns 'alpine'.
212+
* Otherwise, it returns the platform string provided by the 'os' module.
213+
*
214+
* @returns The platform of the current operating system.
215+
*/
216+
function getPlatform (): NodeJS.Platform | 'alpine' {
217+
return fs.existsSync('/etc/alpine-release') ? 'alpine' : os.platform();
218+
}
219+
209220
/**
210221
* Returns the name of the server binary file for the current OS and architecture
211222
*
212223
* @return the name of the server binary file for the current OS and architecture
213224
*/
214225
function getServerBinaryNameWithoutExtension(): string {
215-
switch (os.platform()) {
226+
switch (getPlatform()) {
216227
case 'darwin':
217228
switch (os.arch()) {
218229
case 'arm64':
@@ -221,7 +232,7 @@ function getServerBinaryNameWithoutExtension(): string {
221232
return 'lemminx-osx-x86_64';
222233
}
223234
default:
224-
return `lemminx-${os.platform}`;
235+
return `lemminx-${getPlatform()}`;
225236
}
226237
}
227238

0 commit comments

Comments
 (0)