@@ -32,7 +32,6 @@ import {
3232 undefinedIfEmpty ,
3333 getOptOutPreference ,
3434 isAmazonLinux2 ,
35- fs ,
3635 getClientId ,
3736} from 'aws-core-vscode/shared'
3837import { processUtils } from 'aws-core-vscode/shared'
@@ -44,16 +43,11 @@ import { telemetry } from 'aws-core-vscode/telemetry'
4443const localize = nls . loadMessageBundle ( )
4544const logger = getLogger ( 'amazonqLsp.lspClient' )
4645
47- export async function getGlibcPath ( ) : Promise < string | undefined > {
48- for ( const file of [
49- '/opt/vsc-sysroot/lib64/ld-linux-x86-64.so.2' ,
50- '/opt/vsc-sysroot/lib64/ld-linux-aarch64.so.1' ,
51- ] ) {
52- if ( await fs . exists ( file ) ) {
53- return file
54- }
55- }
56- return undefined
46+ export const glibcLinker : string = process . env . VSCODE_SERVER_CUSTOM_GLIBC_LINKER || ''
47+ export const glibcPath : string = process . env . VSCODE_SERVER_CUSTOM_GLIBC_PATH || ''
48+
49+ export function hasGlibcPatch ( ) : boolean {
50+ return glibcLinker . length > 0 && glibcPath . length > 0
5751}
5852
5953export async function startLanguageServer (
@@ -78,9 +72,8 @@ export async function startLanguageServer(
7872 const traceServerEnabled = Settings . instance . isSet ( `${ clientId } .trace.server` )
7973 let executable : string [ ] = [ ]
8074 // apply the GLIBC 2.28 path to node js runtime binary
81- const glibcPath = await getGlibcPath ( )
82- if ( isAmazonLinux2 ( ) && glibcPath ) {
83- executable = [ glibcPath , '--library-path' , '/opt/vsc-sysroot/lib64' , resourcePaths . node ]
75+ if ( isAmazonLinux2 ( ) && hasGlibcPatch ( ) ) {
76+ executable = [ glibcLinker , '--library-path' , glibcPath , resourcePaths . node ]
8477 getLogger ( 'amazonqLsp' ) . info ( `Patched node runtime with GLIBC to ${ executable } ` )
8578 } else {
8679 executable = [ resourcePaths . node ]
0 commit comments