mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
fixes node startup
This commit is contained in:
parent
37eecff6ce
commit
971e1f1b11
1 changed files with 18 additions and 8 deletions
|
|
@ -147,6 +147,7 @@ final class BunServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the vibetunnel command arguments as an array
|
// Build the vibetunnel command arguments as an array
|
||||||
|
// Add Node.js V8 memory options first
|
||||||
var vibetunnelArgs = ["--port", String(port), "--bind", bindAddress]
|
var vibetunnelArgs = ["--port", String(port), "--bind", bindAddress]
|
||||||
|
|
||||||
// Add authentication flags based on configuration
|
// Add authentication flags based on configuration
|
||||||
|
|
@ -184,12 +185,21 @@ final class BunServer {
|
||||||
logger.info("Executing command: \(binaryPath) \(vibetunnelArgs.joined(separator: " "))")
|
logger.info("Executing command: \(binaryPath) \(vibetunnelArgs.joined(separator: " "))")
|
||||||
logger.info("Binary location: \(resourcesPath)")
|
logger.info("Binary location: \(resourcesPath)")
|
||||||
|
|
||||||
// Set up environment - login shell will load the rest
|
// Set up a minimal environment for the SEA binary
|
||||||
var environment = ProcessInfo.processInfo.environment
|
// SEA binaries can be sensitive to certain environment variables
|
||||||
|
var environment = [String: String]()
|
||||||
|
environment["NODE_OPTIONS"] = "--max-old-space-size=4096 --max-semi-space-size=128"
|
||||||
|
|
||||||
// Add Node.js V8 garbage collection optimization flags
|
// Copy only essential environment variables
|
||||||
// These help reduce GC pauses in long-running processes
|
let essentialVars = ["PATH", "HOME", "USER", "SHELL", "LANG", "LC_ALL", "LC_CTYPE"]
|
||||||
environment["NODE_OPTIONS"] = "--max-old-space-size=4096 --max-semi-space-size=128 --optimize-for-size"
|
for key in essentialVars {
|
||||||
|
if let value = ProcessInfo.processInfo.environment[key] {
|
||||||
|
environment[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Node.js memory settings as command line arguments instead of NODE_OPTIONS
|
||||||
|
// NODE_OPTIONS can interfere with SEA binaries
|
||||||
|
|
||||||
process.environment = environment
|
process.environment = environment
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue