mirror of
https://git.sanhost.net/sanasol/hytale-f2p
synced 2026-02-26 18:41:48 -03:00
fix: Use inline shell LD_PRELOAD instead of wrapper script
Simpler approach - pass LD_PRELOAD directly in the shell command instead of using a wrapper script. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -406,27 +406,20 @@ exec "$REAL_JAVA" "\${ARGS[@]}"
|
|||||||
spawnOptions.windowsHide = true;
|
spawnOptions.windowsHide = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Linux: Use wrapper script to ensure LD_PRELOAD is definitely applied
|
let child;
|
||||||
// This works around potential issues with detached spawn not inheriting env properly
|
|
||||||
let actualClientPath = clientPath;
|
|
||||||
let actualArgs = args;
|
|
||||||
|
|
||||||
|
// Linux: Use shell with inline LD_PRELOAD for maximum compatibility
|
||||||
if (process.platform === 'linux' && env.LD_PRELOAD) {
|
if (process.platform === 'linux' && env.LD_PRELOAD) {
|
||||||
const wrapperPath = path.join(path.dirname(clientPath), 'launcher-wrapper.sh');
|
const quotedArgs = args.map(a => `"${a.replace(/"/g, '\\"')}"`).join(' ');
|
||||||
const wrapperScript = `#!/bin/bash
|
const shellCmd = `LD_PRELOAD="${env.LD_PRELOAD}" "${clientPath}" ${quotedArgs}`;
|
||||||
# Auto-generated wrapper to ensure LD_PRELOAD is applied
|
console.log(`Linux: Launching via shell with LD_PRELOAD`);
|
||||||
export LD_PRELOAD="${env.LD_PRELOAD}"
|
|
||||||
exec "$@"
|
|
||||||
`;
|
|
||||||
fs.writeFileSync(wrapperPath, wrapperScript, { mode: 0o755 });
|
|
||||||
console.log(`Linux: Created wrapper script at ${wrapperPath}`);
|
|
||||||
|
|
||||||
actualClientPath = wrapperPath;
|
spawnOptions.shell = '/bin/bash';
|
||||||
actualArgs = [clientPath, ...args];
|
child = spawn(shellCmd, [], spawnOptions);
|
||||||
|
} else {
|
||||||
|
child = spawn(clientPath, args, spawnOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
const child = spawn(actualClientPath, actualArgs, spawnOptions);
|
|
||||||
|
|
||||||
console.log(`Game process started with PID: ${child.pid}`);
|
console.log(`Game process started with PID: ${child.pid}`);
|
||||||
|
|
||||||
let hasExited = false;
|
let hasExited = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user