Skip to content

Commit

Permalink
Fix Alpine Linux binary server (redhat-developer#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
cirolosapio authored Jul 18, 2024
1 parent c30fe32 commit ae488d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"binaryServerDownloadUrl": {
"linux": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-linux.zip",
"alpine": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-alpine.zip",
"osx-x86_64": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-osx-x86_64.zip",
"osx-aarch_64": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-osx-aarch_64.zip",
"win32": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-win32.zip"
Expand Down
15 changes: 13 additions & 2 deletions src/server/binary/binaryServerStarter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,24 @@ function getBinaryEnvironment(): any {
return process.env;
}

/**
* Returns the platform of the current operating system.
* If the OS is Alpine Linux, it returns 'alpine'.
* Otherwise, it returns the platform string provided by the 'os' module.
*
* @returns The platform of the current operating system.
*/
function getPlatform (): NodeJS.Platform | 'alpine' {
return fs.existsSync('/etc/alpine-release') ? 'alpine' : os.platform();
}

/**
* Returns the name of the server binary file for the current OS and architecture
*
* @return the name of the server binary file for the current OS and architecture
*/
function getServerBinaryNameWithoutExtension(): string {
switch (os.platform()) {
switch (getPlatform()) {
case 'darwin':
switch (os.arch()) {
case 'arm64':
Expand All @@ -221,7 +232,7 @@ function getServerBinaryNameWithoutExtension(): string {
return 'lemminx-osx-x86_64';
}
default:
return `lemminx-${os.platform}`;
return `lemminx-${getPlatform()}`;
}
}

Expand Down

0 comments on commit ae488d9

Please sign in to comment.