mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-09 01:16:15 -08:00
fixPath() was called as the very first statement at module load (top-level, before app.setName, before app.whenReady), which on macOS/Linux spawns an interactive login shell — bash/zsh -ilc 'env' — and waits SYNCHRONOUSLY for it to print the environment back. With oh-my-zsh / heavy .bashrc setups this is routinely 50-300ms blocking the Electron main process before window creation can even begin. The only purpose of fixPath in this app is to populate process.env.PATH so that subsequently-spawned external player binaries (MPV/VLC) can be resolved by bare name. That's a user-action path (clicking play with external player configured), not a startup-critical one. Two callers exist (player.events.ts) and both fall back to bare 'mpv' / 'vlc' only after checking well-known absolute paths. Move the call into a setImmediate scheduled at the END of bootstrapAppEvents — after DB init, IPC handler registration, and window load. The user-visible startup sequence no longer carries the shell-spawn cost. By the time anyone could plausibly click an external player, PATH is already hydrated. Idempotent + Windows-gated (fix-path is a no-op on Windows anyway). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Entire-Checkpoint: f957cd9849e0