ui.electron_port_conflict¶
Electron main-process helpers for detecting a TCP listener on the embedded UI port, classifying whether it looks like a stale taskclf sidecar, and terminating it before a new sidecar starts.
Source¶
Implementation lives in electron/port_conflict.ts.
Behavior summary¶
- Uses OS-native probes (
lsof/sson Unix, PowerShell on Windows) to find the listening PID and command line. classifyListenerCommandLineapplies conservative rules: auto-recovery only when evidence matches the packagedbackend/entrylayout orpython -m taskclf.cli.main tray …with Electron sidecar flags.killPidAndWaitForPortFreesendsSIGTERM(Unix) ortaskkill(Windows), polls until the port is free, then escalates toSIGKILL//Fif needed.
User-visible startup flow (dialogs, launcher log lines) is documented in
electron_shell.
Integration¶
- Consumed by
electron/main.ts. - Covered by
electron/port_conflict.test.js(runmake electron-test).